获得内存卡的剩余内存
public static boolean hasStorageUsage() {File path = Environment.getDataDirectory();
StatFs stat = new StatFs(path.getPath());
long blockSize = stat.getBlockSize();
long availableBlocks = stat.getAvailableBlocks();
float freeStorage = (availableBlocks * blockSize)/(1024 * 1024);
if (freeStorage >= minStorageUsage) {
return true;
}
return false;
}
注:package android.os.StatFs.java;
作者:hahashui123
补充:移动开发 , Android ,