Reputation: 11813
When executing the code
File path = new File("/data");
boolean isDir = path.isDirectory();
//isDir is true
String[] fList = path.list();
//fList == null!
on an Android 2.3 emulator, the file list is null. This seems to contradict the statement from the documentation http://developer.android.com/reference/java/io/File.html#list():
Returns null if this file is not a directory.
What's wrong here?
Upvotes: 5
Views: 5049
Reputation: 8380
You can't access /data
dir since you don't have root access. Without root privileges you can access just an external storage and your app's dir at internal storage.
Look at this answer: https://stackoverflow.com/a/1043722/1037294
Upvotes: 3