0

Following an answer from this post I have run the following code:

String path = Environment.getExternalStorageDirectory().toString();
Log.d("Files", "Path: " + path);
File f = new File(path);
File file[] = f.listFiles();
Log.d("Files", "Size: " + file.length);

which results in an NullPointerException, as the array file seems to be empty. However, the location /storage/emulated/0 to which the variable path refers to, is NOT empty.

What is going on? Why is the list of files empty, althugh there are files in that directory?

Community
  • 1
  • 1
Alex
  • 41,580
  • 88
  • 260
  • 469

0 Answers0