The documentation for File.listFiles()
suggests that null
will ONLY be returned in the case that the file calling it is not a directory.
I have the following:
String dir = "/storage/emulated/0";
File f = new File(dir);
Log.v("Files",f.exists()+"");
Log.v("Files",f.isDirectory()+"");
Log.v("Files",f.listFiles()+"");
The log reads:
true
true
null
For some reason, listFiles(
) is returning null
even though the File
is recognized as a valid directory. I'm not super familiar with Android file hierarchy behavior, so I would guess the problem lies in there.
For reference, I'm debugging on my Moto X, and results are the same whether the phone is plugged in to my computer or not - so I don't think it has to do with mounting when plugged in.