Android examples for android.os:SD Card
get SD Card Size
import java.io.File; import android.os.Environment; import android.os.StatFs; public class Main { public static long getSDSize(boolean all) { long blocks = 0; File path = Environment.getExternalStorageDirectory(); StatFs sf = new StatFs(path.getPath()); long blockSize = sf.getBlockSize(); if (all) {/*w ww .j a v a2 s.com*/ blocks = sf.getBlockCount(); } else { blocks = sf.getAvailableBlocks(); } return (blocks * blockSize) / 1024 / 1024; // ?????MB } }