How to Detect Lowmemory in android?

前端 未结 7 1647
-上瘾入骨i
-上瘾入骨i 2021-02-13 14:34

My application has a lot of images and sometimes it crashes due to low memory. I wrote this function that I found on the developer site.

public void onLowM         


        
7条回答
  •  我在风中等你
    2021-02-13 15:12

    From API level 14, there's method called onTrimMemory(int) that fit your need.

    Here's the doc:

    http://developer.android.com/reference/android/content/ComponentCallbacks2.html

    You're able to be notified when the system is about to recollect memory and also how critical the current situation is.

提交回复
热议问题