Java tutorial
//package com.java2s; import android.os.Handler; import android.os.Looper; public class Main { public static void gcDelay(long delay) { new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { @Override public void run() { gc(); } }, delay); } public static void gc() { systemGC(); runtimeGC(); } public static void systemGC() { System.gc(); } public static void runtimeGC() { Runtime.getRuntime().gc(); } }