Android OutOfMemoryError in SetContentView line

后端 未结 4 1739
心在旅途
心在旅途 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:29

    I would check the size of all your images referred to in your ImageViews. If they are large, maybe encode them as different image types to reduce the image size. The Android system is periodically running out of memory and crashing your application currently. It makes sense that you are getting this only sometimes as it depends on how much memory is currently being used for other applications etc... . If you reduce the size of your images significantly you should be able to resolve this.

提交回复
热议问题