List of utility methods to do SDCard Check
int | getFreeMemory(String path) get Free Memory StatFs statFs = new StatFs(path); int free = (statFs.getAvailableBlocks() * statFs.getBlockSize()); return Math.abs(free); |
boolean | isSdcardAvailable() if sdcard available return true ,else return false String sdcardStatus = Environment.getExternalStorageState();
return sdcardStatus.equals(Environment.MEDIA_MOUNTED) ? true
: false;
|
boolean | sdCardIsMounted() sd Card Is Mounted return Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState());
|
String | getSdCardRootPath() get Sd Card Root Path return Environment.getExternalStorageDirectory().getAbsolutePath() .replace("/mnt", "") + File.separator; |
boolean | sdCardIsWork() sd Card Is Work if (Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED)) { return true; return false; |
boolean | isExternalStorageAvailable() is External Storage Available return Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState())
|| !isExternalStorageRemovable();
|
boolean | isExternalStorageRemovable() is External Storage Removable if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { return Environment.isExternalStorageRemovable(); return true; |
boolean | isExternalStorageReadable() 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; |
boolean | isExternalStorageWritable() is External Storage Writable String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { return true; return false; |
boolean | isExternalStorageRemovable() is External Storage Removable if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { return Environment.isExternalStorageRemovable(); return true; |