Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.ActivityManager; import android.app.ActivityManager.MemoryInfo; import android.content.Context; public class Main { public static long getAvailableRamInMegs(Context context) { MemoryInfo mi = new MemoryInfo(); ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); long availableMegs = mi.availMem / 1048576L; return availableMegs; } }