开发者

Android OutOfMemoryException

开发者 https://www.devze.com 2023-02-16 20:37 出处:网络
Is there any way to handle OutOfMemoryException in开发者_StackOverflow中文版 Android while using Bitmap of large number of pictures. I tried all the solutions given in this site ie(GC, Bitmap.reset())

Is there any way to handle OutOfMemoryException in开发者_StackOverflow中文版 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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消