Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does decoding bitmap with inBitmap always get java.lang.IllegalArgumentException: P ro blem decoding into existing bitmap

I am using inBitmap to load bitmap on android3+. But I always get java.lang.IllegalArgumentException: Problem decoding into existing bitmap.

In LruCache's entryMoved() function: I use reusableBitmaps.add(new SoftReference<Bitmap>(oldValue.getBitmap())); to keep bitmap.

and next time to load bitmap: I use iterator on reusableBitmaps to find which one I can use for inBitmap, I use iterator to find which one, just like managing memory on official developer website.

But unfortunately, failed always, logcat shows java.lang.IllegalArgumentException: Problem decoding into existing bitmap.

Anyone can give me a sample or tutorial?

like image 600
myth2loki Avatar asked Dec 27 '22 05:12

myth2loki


1 Answers

I fixed this using:

options.inSampleSize = 1;

This is a tip from the video mentioned at the second comment to the question.

like image 195
Amir Uval Avatar answered May 16 '23 08:05

Amir Uval