java - Android App using opencv: how to save an image without overwriting? -


i'm using following code save image folder when select option:

file path = environment.getexternalstoragepublicdirectory(environment.directory_pictures); string filename = "teste.png"; file file = new file(path, filename); filename = file.tostring(); highgui.imwrite(filename, mrgba); 

but i'd saved image not overwrite image that's in folder. how that? using kind of index each image or that, think, how?

thanks.

maybe this?

file mediastoragedir = new file(environment.getexternalstoragepublicdirectory(environment.directory_pictures), "myappdir");  if (!mediastoragedir.exists()) {     if (!mediastoragedir.mkdirs()) {         log.e(tag, "failed create directory");         return null;     } }  string timestamp = new simpledateformat("yyyymmdd_hhmmss").format(new date()); file mediafile; mediafile = new file(mediastoragedir.getpath() + file.separator + "testimage_" + timestamp + ".png"); 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -