I need to know in the most of the devices the sd card path. I have some problems for that I actually use:
Environment.getExternalStorageDirectory();
This is always the best approach:
Environment.getExternalStorageDirectory();
You could also get the environmental variable which is on all Android devices like this:
String sdcardPath = System.getenv("EXTERNAL_STORAGE");
I think this is best one ...
Cursor cursor = getContentResolver().query(_uri, new String[] { ndroid.provider.MediaStore.Images.ImageColumns.DATA }, null, null, null);
cursor.moveToFirst();
There is no "sd card path" in Android.
At the present time, Android has internal storage and external storage, and that is it. Environment.getExternalStorageDirectory();
returns the root of external storage. Whether external storage is:
is up to the device manufacturer.
Similarly, if the device manufacturer offers additional data stores (e.g., a removable card in addition to external storage as part of on-board flash), right now, those additional data stores are for the exclusive use of the device manufacturer. That manufacturer may elect to document how you can use them, or the manufacturer may integrate those data stores with something else that you can access (e.g., have multimedia files by indexed and accessible via MediaStore
).
You can read more about this in the documentation on external storage.
So, by definition, Environment.getExternalStorageDirectory();
is "the correct path" representing external storage.