Android examples for android.os:Environment
get Total Internal Space
import android.os.Environment; import android.os.StatFs; public class Main { public static long getTotalInternalSpace() { long totalSpace = -1L; try {/*from w w w. jav a2s. c om*/ String path = Environment.getDataDirectory().getPath(); StatFs stat = new StatFs(path); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); totalSpace = totalBlocks * blockSize; } catch (Exception e) { } return totalSpace; } }