16

Is there a way to find out the path used by android to save screenshots?

Can I get the path from a code?

Edgar Rokjān
  • 17,245
  • 4
  • 40
  • 67
radya
  • 422
  • 1
  • 5
  • 13

3 Answers3

12

Android's API has no fixed path for screenshots but

File pix = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File screenshots = new File(pix, "Screenshots");

might work. That's what ICS uses as path.

zapl
  • 63,179
  • 10
  • 123
  • 154
7

The "Screenshots" value is part of the private API.

Here is link to the source code where the value is set. Since the class is loaded in our application context there is no option to access the field. I'd hardcode it as @zapi suggested.

Rudy Rudolf
  • 227
  • 2
  • 3
1

Few might find this usefull..

 public static File mDir= new File(String.valueOf(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)));
 public static File mDirScreenshots = new File(mDir,"Screenshots");

And to fetch the screenshots

 public static ArrayList<File> getAllScreenshots(File dir){
    File listFile[] = dir.listFiles();
    if (listFile != null && listFile.length > 0) {
        for (int i = 0; i < listFile.length; i++) {
            Log.e(YOUR_TAG, "getAllScreenshots: " + i + listFile[i].getName());
            mScreenshotsFiles.add(listFile[i]);
        }
    }
    return mScreenshotsFiles;
}
prem
  • 41
  • 5