Java tutorial
//package com.java2s; import android.os.Build; import android.os.StatFs; import java.io.File; public class Main { /** * Check how much usable space is available at a given path. * * @param path * The path to check * @return The space available in bytes */ public static long getUsableSpace(File path) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); } }