bitmap size exceeds VM budget in android

后端 未结 5 730
一整个雨季
一整个雨季 2021-01-03 16:49

Getting this

05-25 23:55:59.145: ERROR/AndroidRuntime(3257): java.lang.OutOfMemoryError: bitmap size exceeds VM budget

at this code of min

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-03 17:19

    Android has a relatively limited amount of spare of memory for bitmaps (which can get smaller depending on what else is going on in the device). So the other answers are correct...

    • scale the bitmap down (in pixels or resolution)
    • only display the subset of teh bitmap that is visible to the user.

    Check out Displaying a bitmap of arbitrary size without running out of memory for background on what's going on under the covers - which might help you avoid the OOM.

提交回复
热议问题