Java tutorial
//package com.java2s; import android.os.Environment; import android.os.StatFs; public class Main { public static final int MB = 1024 * 1024; public static int freeSpaceOnSd() { StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); double sdFreeMB = ((double) stat.getAvailableBlocks() * (double) stat.getBlockSize()) / MB; return (int) sdFreeMB; } }