Here you can find the source of getExternalStorageFreeSize()
public static long getExternalStorageFreeSize()
//package com.java2s; import android.os.Environment; import android.os.StatFs; public class Main { /**/* ww w .j av a 2 s .c o m*/ * Obtain SD card free size. * * @return byte unit of SD card free size. */ public static long getExternalStorageFreeSize() { final StatFs statfs = new StatFs(Environment .getExternalStorageDirectory().getAbsolutePath()); final long availableBlocks = statfs.getAvailableBlocks(); final long blockSize = statfs.getBlockSize(); return availableBlocks * blockSize; } }