File root = Environment.getExternalStorageDirectory();
if (root == null)
return null;
File parent = root.getParentFile();
if (parent == null)
return null;
File storage = parent.getParentFile();
if (storage == null)
return null;
File[] files = storage.listFiles();
for (File file : files) {
String path = file.getName();
if (path.equals("emulated"))
continue;
if (path.equals("self"))
continue;
return file.getAbsolutePath();
}
return null;
}
No comments:
Post a Comment