Java tutorial
//package com.java2s; import android.app.ActivityManager; import android.app.ActivityManager.MemoryInfo; import android.content.Context; public class Main { private static long getAvailabeMemoryM(final Context cxt) { MemoryInfo mi = new MemoryInfo(); ActivityManager activityManager = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); return mi.availMem / 1024 / 1024; } }