public boolean isAvaiableSpace(float sizeMB){
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
String sdcard =Environment.getExternalStorageDirectory().getPath();
StatFs statFs =new StatFs(sdcard);
long blockSize=statFs.getBlockSize();
long ablocks =statFs.getAvailableBlocks();
float available=(float)((ablocks*blockSize)/(1024*1024));
if (sizeMB > available)
return false;
else
return true;
}
return false;
}
沒有留言:
張貼留言