Android examples for Hardware:Memory
get Memory Size
//package com.java2s; import java.io.File; import android.content.Context; import android.os.Environment; import android.os.StatFs; public class Main { @SuppressWarnings("deprecation") public static int getMemSize(Context context) { try {//from www .j a v a 2 s .com File root = Environment.getDataDirectory(); StatFs sf = new StatFs(root.getPath()); return (int) ((long) sf.getBlockCount() * (long) sf.getBlockSize() / (1024 * 1024)); } catch (Exception e) { } return -1; } }