Android Exceptions edit

OutOfMemoryError

This is a runtime error that happens when you request a large amount of memory on the heap. This is common when loading a Bitmap into an ImageView.

You have some options:

  1. Use a large application heap

Add the “largeHeap” option to the application tag in your AndroidManifest.xml. This will make more memory available to your app but will likely not fix the root issue.

<application largeHeap="true" ... >
  1. Recycle your bitmaps

After loading a bitmap, be sure to recycle it and free up memory:

if (bitmap != null && !bitmap.isRecycled())
   bitmap.recycle();
  1. Load sampled bitmaps into memory

Avoid loading the entire bitmap into memory at once by sampling a reduced size, using BitmapOptions and inSampleSize.

See Android documentation for example


Table Of Contents
11 Exceptions
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close