Reputation: 12159
I forsee that my application will require the existence of a sdcard storage device. How do I query the device for a manifest of storage options ?
Upvotes: 6
Views: 5813
Reputation: 901
This is working and very easy to understand
TextView state = (TextView) findViewById(R.id.sdcardstatus);
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
state.setText("SD card is present");
} else {
state.setText("SD card is not present");
}
Or refer on this tutorial
HAPPY CODING!
Upvotes: 1
Reputation: 5189
You can use getExternalStorageState()
. The developer site (linked here) has a short snippet of the recommended way to check for the presence of the external SD card, and whether or not you can write to it.
Upvotes: 5