naresh naresh - 1 month ago 6
Android Question

Check whether the SD card is available or not programmatically

My app is working for mobiles which have an SD card only. So programmatically I want to check if the SD card is available or not and how to find the SD card free space. Is it possible?

If yes, how do I do it?

Answer
Boolean isSDPresent = android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);

if(isSDPresent)
{
  // yes SD-card is present
}
else
{
 // Sorry
}