本文整理了Java中android.support.v7.app.AppCompatActivity.onTrimMemory()
方法的一些代码示例,展示了AppCompatActivity.onTrimMemory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppCompatActivity.onTrimMemory()
方法的具体详情如下:
包路径:android.support.v7.app.AppCompatActivity
类名称:AppCompatActivity
方法名:onTrimMemory
暂无
代码示例来源:origin: retomeier/Wrox-ProfessionalAndroid-4E
@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.
}
}
代码示例来源:origin: bxbxbai/ZhuanLan
public void onTrimMemory(int level) {
super.onTrimMemory(level);
StopWatch.log("level: " + level);
}
}
代码示例来源:origin: shazam/android-aspects
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
dispatcher.dispatchOnTrimMemory(this, level);
}
代码示例来源:origin: derry/delion
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
if (mMemoryUma != null) mMemoryUma.onTrimMemory(level);
}
内容来源于网络,如有侵权,请联系作者删除!