Android : java.lang.OutOfMemoryError:

后端 未结 6 1687
太阳男子
太阳男子 2020-11-27 23:29

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

There are lots of images present in drawable folder say more then 100, I am developing application fo

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 23:56

    In the above answer there is a getResources() missing in

    img.setImageBitmap(decodeSampleBitmapFromResource(R.drawable.dog_animation, width, height));
    

    so it becomes

    img.setImageBitmap(decodeSampleBitmapFromResource(getResources(), R.drawable.dog_animation, width, height));
    

提交回复
热议问题