You can check if the SD card is available by using the .getExternalStorageState and the .Environment.MEDIA_MOUNTED like this:
private Boolean isSDPresent() { return android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED); }
It returns true if the SD card is present otherwise it’s false. To use just put it into an if-statement like this:
if (isSDPresent())
{
// SD-card is present
}
else
{
// SD-card not present
}