Caused by: java.lang.OutOfMemoryError: Failed to allocate a 35624972 byte allocation with 4194304 free bytes and 28MB until OOM

前端 未结 2 1824
醉酒成梦
醉酒成梦 2021-01-16 07:41

Here is my code:

BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResource         


        
相关标签:
2条回答
  • 2021-01-16 08:16

    Thanks to @CommonsWare and @petey,Loading Large Bitmaps Efficiently works for me.

    0 讨论(0)
  • 2021-01-16 08:20

    This alerts you that in some devices you could have memory problems doing this. Try resizing the image to reduce his size. You also can set a larger memory heap witting android:largeHeap="true" in the manifest but i wouldn't recommend that.

    0 讨论(0)
提交回复
热议问题