Skip to content Skip to sidebar Skip to footer

Loading Large Bitmaps Efficiently Android

I'm trying to load large bitmap. I read this: http://developer.android.com/training/displaying-bitmaps/load-bitmap.html and I try to create the same method from string public stati

Solution 1:

Try adding is.reset() before you want to load the bitmap "for real"

// First make sure you are using a BufferedInputStream
InputStream bis = new BufferedInputStream(is)

// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
bis.reset();

I believe funny things happen to the stream when you use inJustDecodeBounds = true. It will have read some of the stream for that operation. Resetting it works for me.

Edit: you'll need to wrap your inputStream object into a BufferedInputStream, which supports .reset().

Post a Comment for "Loading Large Bitmaps Efficiently Android"