How to solve OutOfMemoryError in Glide Image Loading .
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 5137932 byte allocation with 923120 free bytes and 901KB until OOMSent on:2:54 threw uncaught throwablejava.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Failed to allocate a 5137932 byte allocation with 923120 free bytes and 901KB until OOMat java.util.concurrent.FutureTask.report(FutureTask.java:94)at java.util.concurrent.FutureTask.get(FutureTask.java:164)at
com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor.afterExecute(FifoPriorityThreadPoolExecutor.java:96)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)at java.lang.Thread.run(Thread.java:818)at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118)Caused by: java.lang.OutOfMemoryError: Failed to allocate a 5137932 byte allocation with 923120 free bytes and 901KB until OOMat dalvik.system.VMRuntime.newNonMovableArray(Native Method)at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:882)at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:858)at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeStream(Downsampler.java:329)at com.bumptech.glide.load.resource.bitmap.Downsampler.downsampleWithSize(Downsampler.java:220)at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:153)at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:50)at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:19)at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:39)at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:20)at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decodeBitmapWrapper(GifBitmapWrapperResourceDe
Glide Image Loder Code for loading Images
Glide.with(activity)
.load(items.get(position).getCharacterImageId(activity.getResources())) .placeholder(items.get(position).getColor(activity.getResources()))
.dontAnimate()
.thumbnail(0.7f)
.into(img_letter);