Home > DeveloperSection > Forums > How to check SDcard exist on Android device.
Pooja Malohtra
Pooja Malohtra

Total Post:47

Points:331
Posted on    June-16-2015 10:40 PM

 Android Android  Android Emulator 
Ratings:


 1 Reply(s)
 522  View(s)
Rate this:
I want to create a folder in sdcard programmatically but before create folder I want to know sdcard is available or not.


Manoj Pandey

Total Post:26

Points:188
Posted on    June-16-2015 10:50 PM

Hi Pooja, follow below code to check sd card available or not

boolean isSDPresent = android.os.Environment.getExternalStorageState()

.equals(android.os.Environment.MEDIA_MOUNTED);

if (isSDPresent) {

// yes SD-card is present

// create folder

}

else  {

// Sorry SD card is not available

}

 

 

 


Don't want to miss updates? Please click the below button!

Follow MindStick