Android examples for File Input Output:File System
get File System Available Size
import java.io.File; import android.os.StatFs; public class Main { private static final String TAG = "AndroidUtil"; public static long getFileSystemAvailableSize(File dirName) { long availableSize = -1; if (dirName != null && dirName.exists()) { StatFs sf = new StatFs(dirName.getPath()); long blockSize = sf.getBlockSize(); long blockCount = sf.getBlockCount(); long availableBlocks = sf.getAvailableBlocks(); availableSize = availableBlocks * blockSize / 1024; }/* w w w. j a va 2 s. com*/ return availableSize; } }