Android examples for android.os:StatFs
get USB Size
import android.os.StatFs; public class Main { public static long getUSBSize(String path, boolean all) { long blocks = 0; StatFs sf = new StatFs(path); long blockSize = sf.getBlockSize(); if (all) {// ww w. j av a 2 s. c om blocks = sf.getBlockCount(); } else { blocks = sf.getAvailableBlocks(); } return (blocks * blockSize) / 1024 / 1024; } }