@Override public void onTrimMemory(int level) { super.onTrimMemory(level); // Application is a candidate for termination. if (level >= TRIM_MEMORY_COMPLETE) { // Release all possible resources to avoid immediate termination. } else if (level >= TRIM_MEMORY_MODERATE) { // Releasing resources now will and make your app less likely // to be terminated. } else if (level >= TRIM_MEMORY_BACKGROUND) { // Release resources that are easy to recover now. } // Application is no longer visible. else if (level >= TRIM_MEMORY_UI_HIDDEN) { // Your application no longer has any visible UI. Free any resources // associated with maintaining your UI. } // Application is running and not a candidate for termination. else if (level >= TRIM_MEMORY_RUNNING_CRITICAL) { // The system will now begin killing background processes. // Release non-critical resources now to prevent performance degradation // and reduce the chance of other apps being terminated. } else if (level >= TRIM_MEMORY_RUNNING_MODERATE) { // Release resources here to alleviate system memory pressure and // improve overall system performance. } else if (level >= TRIM_MEMORY_RUNNING_LOW) { // The system is beginning to feel memory pressure. } }
public void onTrimMemory(int level) { super.onTrimMemory(level); StopWatch.log("level: " + level); } }
@Override public void onTrimMemory(int level) { super.onTrimMemory(level); dispatcher.dispatchOnTrimMemory(this, level); }
@Override public void onTrimMemory(int level) { super.onTrimMemory(level); if (mMemoryUma != null) mMemoryUma.onTrimMemory(level); }