Android examples for android.os:Memory
check Memory via Runtime
import android.os.SystemClock; public class Main { public static boolean checkMemory(long size) { Runtime runtime = Runtime.getRuntime(); long freeMemory = runtime.freeMemory(); if (size * 2 < freeMemory) { return true; } else {//w ww .ja v a 2 s . co m System.gc(); } SystemClock.sleep(500); if (size * 2 < freeMemory) { return true; } else { return false; } } }