Java tutorial
//package com.java2s; import android.app.Activity; import android.app.ActivityManager; public class Main { public static int getRamTotalMB(Activity mActivity) { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) mActivity.getSystemService(Activity.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); int total = (int) (mi.totalMem / 1048576L); return total; } }