curtjacobs1
curtjacobs1

Reputation: 351

Saving Screenshot with an assigned name in a Series

I have been looking for a few days and I cannot find an example of assigning a String name to a series of screenshots so I can recall the screenshots from memory using the base name + 1,2,3 etc. assigned to the screenshot when it is saved.

Taking and saving the screenshot is well documented, as is opening the OutputStream with a .jpg or .png incremental name. I have been looking for the line of code to link the name the OutputStream is opened with to the name the screenshot object is created with.

I realize I will have to close the OutputStream and reopen it with the incremented name as I make my changes to the screen and then take the new screenshot.

As I look at the CameraDemo on GitHub it looks to be implied that the camera shot is saved as the OutputStream name because I do not see a link between the capture and the save. I can't determine if that is the case.

To reopen the screenshots I will recover the screenshot group base name from a Text file and then recover the screenshots in the order they were saved to play in the ImageViewer. Thanks for any help you can give me.

Upvotes: 1

Views: 34

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

Do you mean this?

public String getCurrentName() {
    return "Screenshot-" + Preferences.get("screenshot-number", 1);
}

public String getNextName() {
    int next = Preferences.get("screenshot-number", 1) + 1;
    Preferences.set("screenshot-number", next);
    return "Screenshot-" + next;
}

Upvotes: 0

Related Questions