Android examples for android.os:Memory
get Device Available Memory
import android.app.ActivityManager; import android.app.Application; import android.content.Context; public class Main { private static Application sApp; /**/*w w w . j a va 2s . c o m*/ * return device available memory */ public static int getDeviceAvailableMemory() { ActivityManager am = (ActivityManager) sApp.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); am.getMemoryInfo(mi); return (int) (mi.availMem / (1024 * 1024)); } }