Reputation: 54781
I'm saving a picture like so:
File dcimDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
File picsDir = new File(dcimDir, "MyPics");
picsDir.mkdirs(); //make if not exist
File newFile = new File(picsDir, "image.png"));
OutputStream os;
try {
os = new FileOutputStream(newFile);
target.compress(CompressFormat.PNG, 100, os);
os.flush();
os.close();
b.recycle();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
However, when I look for the image through windows it is in the internal memory, the gallery confirms this:
This last one is confusing, it says internal memory, but then also has sdcard0
in file path.
So when does external not mean external? Is it a device set up thing, or an I miss-using/miss-understanding getExternalStoragePublicDirectory
?
Upvotes: 16
Views: 40351
Reputation: 1006539
The MTP engine sometimes reports getExternalStorageDirectory()
as "Internal Storage", which is why it shows up under that name when you mount the device as a volume on Windows, Linux, etc.
External storage has always meant the storage that the user can access by means of a USB cable. The "Internal Storage" label is probably used on devices where external storage is part of the on-board ("internal") flash.
Upvotes: 17