1

I would like to know how to get a file from its name.

I use the camera to take a photo. It saved the photo with this:

String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());
File mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg");

And now (after closing and opening again the app), I would like to get the file or Uri from the name of the picture (I saved it in a string (timeStamp)) to a preview.

Sorry for my english.

user3301969
  • 13
  • 1
  • 1
  • 4
  • You need to store the path of file in session or database to can retrieve the file later. with the path just instantiate `new File(path)` – IgniteCoders Nov 17 '16 at 13:54

0 Answers0