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

后端 未结 4 2017
暗喜
暗喜 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条回答
  •  Happy的楠姐
    2020-12-18 09:49

    This answer has 2 parts

    1) its not how much images the screen has, but being carefull on cleaning everything up when finishing the activity

    2) (Future-Proofing Your App)

    Technique to Avoid, #3: Going Overboard with Layouts

    Due to changes in the View rendering infrastructure, unreasonably deep (more than 10 or so) or broad (more than 30 total) View hierarchies in layouts are now likely to cause crashes. This was always a risk for excessively complex layouts, but you can think of Android 1.5 as being better than 1.1 at exposing this problem. Most developers won't need to worry about this, but if your app has very complicated layouts, you'll need to put it on a diet. You can simplify your layouts using the more advanced layout classes like FrameLayout and TableLayout.

    Daniel

提交回复
热议问题