Android examples for Hardware:SD Card
Obtain SD card total size.
//package com.java2s; import android.os.Environment; import android.os.StatFs; public class Main { /**// www .j a v a 2s. c o m * Obtain SD card total size. * * @return byte unit of SD card total size. * @author Sean Zheng * @CreateDate 2013-4-23 */ public static long getExternalStorageTotalSize() { final StatFs statfs = new StatFs(Environment .getExternalStorageDirectory().getAbsolutePath()); final long blockCount = statfs.getBlockCount(); final long blockSize = statfs.getBlockSize(); return blockCount * blockSize; } }