I am trying to check if a file exists in my user's Download directory.
File imageFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),imageName);
if(imageFile.exists())
// Do something
else
// Do something else
I have gotten the contents of the directory
File did = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS));
File files[] = dir.listFiles();
In the debugger:
imageFile.path = "/storage/emulated/0/Download/floorplan_lobby.png"
And
files[12].path = "/storage/emulated/0/Download/floorplan_lobby.png"
But imageFile.exists()
returns false. Why?
It shouldn't matter, but I'm using a Samsung Galaxy Note.