Android examples for Hardware:SD Card
Obtain SD card free size.
//package com.java2s; import android.os.Environment; import android.os.StatFs; public class Main { /**// w w w .java 2s. c om * 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; } }