android.support.v7.app.AppCompatActivity.onTrimMemory()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中android.support.v7.app.AppCompatActivity.onTrimMemory()方法的一些代码示例,展示了AppCompatActivity.onTrimMemory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppCompatActivity.onTrimMemory()方法的具体详情如下:
包路径:android.support.v7.app.AppCompatActivity
类名称:AppCompatActivity
方法名:onTrimMemory

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);
}

相关文章

微信公众号

最新文章

更多

AppCompatActivity类方法