如何在本地存储上找到剩余/总空间?
我可以使用StatF(如 - How to Check available space on android device ? on SD card?)
答案 0 :(得分:2)
原来你可以。抛出这段代码,它似乎返回了我内部存储器中剩余的适当字节数。不确定Environment.getDataDirectory()
public static long remainingLocalStorage()
{
StatFs stat = new StatFs(Environment.getDataDirectory().getPath());
stat.restat(Environment.getDataDirectory().getPath());
long bytesAvailable = (long)stat.getBlockSize() *(long)stat.getAvailableBlocks();
return bytesAvailable;
}