Recently, I needed to be able to write some data strictly on a phone\'s external, removable storage (aka SDCard). For lower-end devices without \"external\" internal storage
I'm not sure how reliable this would be but since the removable SD card contains the LOST.DIR folder at its root and gets recreated upon boot (in cases where the user might delete it)...
File root = new File(Environment.getExternalStorageDirectory().getAbsolutePath());
for (File sub : root.listFiles()) {
if (new File(sub + "/lost.dir").exists()) {
// 'sub' is probably the removable SD
break;
}
}
If 'sub' is found with a LOST.DIR folder , might want to write its value to sharedPrefs so that this lookup is only performed one time (if there is no value stored) and then just fetched from prefs, OR so that the app knows this path even in case the user deleted LOST.DIR and it currently doesn't exist anywhere.