Android Utililty Methods SDCard Check

List of utility methods to do SDCard Check

Description

The list of methods to do SDCard Check are organized into topic(s).

Method

intgetFreeMemory(String path)
get Free Memory
StatFs statFs = new StatFs(path);
int free = (statFs.getAvailableBlocks() * statFs.getBlockSize());
return Math.abs(free);
booleanisSdcardAvailable()
if sdcard available return true ,else return false
String sdcardStatus = Environment.getExternalStorageState();
return sdcardStatus.equals(Environment.MEDIA_MOUNTED) ? true
        : false;
booleansdCardIsMounted()
sd Card Is Mounted
return Environment.MEDIA_MOUNTED.equals(Environment
        .getExternalStorageState());
StringgetSdCardRootPath()
get Sd Card Root Path
return Environment.getExternalStorageDirectory().getAbsolutePath()
        .replace("/mnt", "")
        + File.separator;
booleansdCardIsWork()
sd Card Is Work
if (Environment.getExternalStorageState().equals(
        Environment.MEDIA_MOUNTED)) {
    return true;
return false;
booleanisExternalStorageAvailable()
is External Storage Available
return Environment.MEDIA_MOUNTED.equals(Environment
        .getExternalStorageState())
        || !isExternalStorageRemovable();
booleanisExternalStorageRemovable()
is External Storage Removable
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
    return Environment.isExternalStorageRemovable();
return true;
booleanisExternalStorageReadable()
is External Storage Readable
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)
        || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
    return true;
return false;
booleanisExternalStorageWritable()
is External Storage Writable
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
    return true;
return false;
booleanisExternalStorageRemovable()
is External Storage Removable
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
    return Environment.isExternalStorageRemovable();
return true;