Java tutorial
//package com.java2s; import android.os.Environment; import android.os.StatFs; public class Main { public static long getSDTotalSize() { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return getTotalSize(Environment.getExternalStorageDirectory().toString()); } return 0; } private static long getTotalSize(String path) { StatFs fileStats = new StatFs(path); fileStats.restat(path); return (long) fileStats.getBlockCount() * fileStats.getBlockSize(); } }