I want to know :
/storage/sdcard0/
and /storage/sdcard1/
directory location for all android devices and versions available and unchanged?
Namely, can i use this /storage/...
in my code?
I want to be sure this is the root of all versions are available or not. !
for example :
File root = new File("/storage/sdcard1");
// or
File root = new File("/storage/sdcard0"); // if UNMOUNTED , i know ..
//File[] files = root.listFiles();
//for(File singlFile: files){
// ...
//}
Is this code is correct? for all android mobile devices? thanks for help.
Absolutely not. They are not even the same for different users on the same device.
NEVER HARDCODE ROOT PATHS. Always use methods on
Context
,Environment
, etc., to get at root paths.