Java tutorial
//package com.java2s; //License from project: LGPL import android.os.Environment; import android.os.StatFs; import java.io.File; public class Main { public static long getTotalExternalMemorySize() { if (isExternalMemoryAvailable() == true) { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = 0; long totalBlocks = 0; blockSize = stat.getBlockSize(); totalBlocks = stat.getBlockCount(); return totalBlocks * blockSize; } else { return -1; } } public static boolean isExternalMemoryAvailable() { return android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED); } }