String sdcard = Environment.getExternalStorageDirectory().getPath();
File file = new File(sdcard);
StatFs statFs = new StatFs(file.getPath());
int availableSpare = (int) (statFs.getBlockSize()*((long)statFs.getAvailableBlocks()-4));
需要import android.os.StatFs;