Skip to content

Instantly share code, notes, and snippets.

@ryancford
Created December 3, 2015 01:06
Show Gist options
  • Save ryancford/cd9816b668ab91dd903d to your computer and use it in GitHub Desktop.
Save ryancford/cd9816b668ab91dd903d to your computer and use it in GitHub Desktop.
Log calls to onTrimMemory().
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
String levelString = "TRIM_MEMORY_RUNNING_MODERATE";
switch (level) {
case TRIM_MEMORY_RUNNING_MODERATE: levelString = "TRIM_MEMORY_RUNNING_MODERATE"; break;
case TRIM_MEMORY_RUNNING_LOW: levelString = "TRIM_MEMORY_RUNNING_LOW"; break;
case TRIM_MEMORY_RUNNING_CRITICAL: levelString = "TRIM_MEMORY_RUNNING_CRITICAL"; break;
case TRIM_MEMORY_BACKGROUND: levelString = "TRIM_MEMORY_BACKGROUND"; break;
case TRIM_MEMORY_MODERATE: levelString = "TRIM_MEMORY_MODERATE"; break;
case TRIM_MEMORY_COMPLETE: levelString = "TRIM_MEMORY_COMPLETE"; break;
case TRIM_MEMORY_UI_HIDDEN: levelString = "TRIM_MEMORY_UI_HIDDEN"; break;
}
Logout.debug("MEMORY", "MEMORY LEVEL REPORTED: " + levelString);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment