Here you can find the source of getAvailableMb(String path)
public static long getAvailableMb(String path)
//package com.java2s; import android.os.StatFs; public class Main { public static long getAvailableMb(String path) { final long SIZE_KB = 1024L; final long SIZE_MB = SIZE_KB * SIZE_KB; long availableSpace = -1L; StatFs stat = new StatFs(path); availableSpace = (long) stat.getAvailableBlocks() * (long) stat.getBlockSize(); return availableSpace / SIZE_MB; }//from www .ja va2 s .c o m }