How do I find remaining/total space on the local storage?
Can I use StatFs for this (as in - How to Check available space 开发者_如何转开发on android device ? on SD card?)
Turns out you can. Ran this code which seems to return the appropriate number of bytes remaining in my internal storage. Unsure about the reliability of 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;
}
精彩评论