iOS的内存警告Android的对手 [英] Android counterpart of iOS memory warning

查看:265
本文介绍了iOS的内存警告Android的对手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS的一个应用程序将收到一个内存警告通过实施一个名为 DidReceiveMemoryWarning 功能,这意味着内存不够用。如果2级版本的警告发出后,应用程序可能会停止生效。

In iOS an app will receive a memory warning by implementing a function called DidReceiveMemoryWarning, which means the RAM is not enough to use. If a Level 2 version of this warning is sent, the app will probably be force stopped.

有没有类似的东西(如广播意图)在Android中告诉我的应用程序,我们出门在外的RAM和我可以编程方式删除某些对象?

Is there something similar (like a broadcast intent) in Android to tell my app that we're out of RAM and i could remove some objects programmatically?

感谢。

推荐答案

您应该通过扩展的 Android的应用程序类,并定义了应用程序标记,对象清单文件。在这个自定义对象可以覆盖<一href="http://developer.android.com/reference/android/app/Application.html#onLowMemory%28%29">onLowMemory()方法。

You should define your own custom application object by extending Android Application class and define that object in the Application tag in the manifest file. In this custom object you can override the onLowMemory() method.

希望这有助于你。

这篇关于iOS的内存警告Android的对手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆