Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class MyActivity : Activity() {
override fun onTrimMemory(level: Int) {
super.onTrimMemory(level)
// Intermediate levels may be added later, so use ranged conditionals
if (level >= TRIM_MEMORY_COMPLETE ||
level in TRIM_MEMORY_RUNNING_CRITICAL until TRIM_MEMORY_UI_HIDDEN) {
imageCache.clear()
webAppMgr.onLowMemory(level)
eventLogger.reportLowMemory(level)
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment