How to determine if the device has an SD card?

I see that my application will need an SD card storage device. How to request a device for manifest storage settings?

+5
source share
2 answers

You can use getExternalStorageState(). The developer's site ( indicated here ) contains a short fragment of the recommended method for checking the availability of an external SD card, and regardless of whether it can write to it.

+5
source

It works and is 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 to this tutorial

HAPPY CODING!

0
source

All Articles