Android OutOfMemoryError in SetContentView line

后端 未结 4 1728
心在旅途
心在旅途 2020-12-21 05:51

When i try to open my chat class , sometimes it runs properly , sometimes it gives OutOfMemoryError at setContentView line.I can\'t understand what is the cause of problem?

4条回答
  •  天涯浪人
    2020-12-21 06:34

    Your OOM error is related to the Images you are loading as I am seeing in your log trace.

    See this for loading large Bitmaps more efficiently:

    A 400 KB image file can easily take up 5-10 MB of RAM.

    For requesting to incraese heap size dynamically, Use android:largeHeap="true" in the manifest.xml.

    or/and just use the proper function to decode...

提交回复
热议问题