Android examples for android.os:Memory
get Available Memory and return MB
import android.app.ActivityManager; import android.content.Context; public class Main { public static long getAvailableMemory(Context context) { ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo(); ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); am.getMemoryInfo(memoryInfo);/*w w w .j ava 2s .c om*/ return memoryInfo.availMem / (1024 * 1024); } }