BufferedInputStream is required before the decoder ....
Try it, it works great for me,
BufferedInputStream buf = new BufferedInputStream(inputsteam, 1024);
Passing buf to decode the stream will work fine.
Bitmap theImage = BitmapFactory.decodeStream(buf);
Finally, set the bitmap.
source share