java.lang.OutOfMemoryError: bitmap size exceeds VM budget - android - how many images?

后端 未结 4 2022
暗喜
暗喜 2020-12-18 08:55

I am developing an android app and as I read all around and learned for myself, I cant have a lot of images on the screen at the same time or I will get an exception.

<
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-18 09:54

    This thing is depends on the HEAP size of phone . so if your application acquire more heap then phone provided then it may be create a problem .

    the new generation android device contain .here is the list of some

    HTC Wildfire (2.2.1) = 16MB.
    HTC Wildfire S (2.3.5) = 20MB.
    HTC Salsa (2.3.3) = 20MB.
    HTC Desire (2.3.3) = 32MB.
    HTC Desire S (2.3.5) = 32MB.
    Samsung Galaxy S GT-I9000 (2.2) = 48MB.
    Samsung Galaxy R GT-I9103 (2.3.5) = 64MB.
    Samsung Galaxy Y GT-S5360 (2.3.5) = 64MB

    so there is not certan solution for it , but you can try to optimize the the bitmap size . for example recycle the bitmap after use it . or make another using bitmapFectory deoeed from sampleSize .

    IF you are using a emulator then you can create a device which contain more heap size to Add new extra hardware configure in your avd manager as VM heap size = 32 or up .

提交回复
热议问题