java.lang.OutOfMemoryError: bitmap size exceeds VM budget - Android

前端 未结 13 1787
醉话见心
醉话见心 2020-11-22 01:32

I developed an application that uses lots of images on Android.

The app runs once, fills the information on the screen (Layouts, Listviews,

13条回答
  •  长情又很酷
    2020-11-22 02:26

    I had the same problem just with switching the background images with reasonable sizes. I got better results with setting the ImageView to null before putting in a new picture.

    ImageView ivBg = (ImageView) findViewById(R.id.main_backgroundImage);
    ivBg.setImageDrawable(null);
    ivBg.setImageDrawable(getResources().getDrawable(R.drawable.new_picture));
    

提交回复
热议问题