有没有什么办法来处理 OutOfMemoryException异常
在Android中,同时使用了大量的图片位图。我尝试了所有在此站点即给出的解决方案(GC,Bitmap.reset())。我只是想知道是否可以前堆内存将会全额产生任何警报?这样我可以用不同的方式处理它。
Is there any way to handle OutOfMemoryException
in Android while using Bitmap of large number of pictures. I tried all the solutions given in this site ie(GC, Bitmap.reset()). I just want to know whether any alert can be generated before the heap memory is going to full? so that i can handle it in a different way.
在你的活动有一个回调函数就可以实现内存不足的问题得到通知:
In your Activity there is a callback function you can implement to be notified of low memory issues:
http://developer.android.com/reference/android/content/ComponentCallbacks.html#onLowMemory()
@Override
public void onLowMemory() {
super.onLowMemory();
// Your memory releasing code
}