I\'m using my localhost to fetch images and to view in an ImageView. For some reason I\'m getting Factory returned null error. I\'ve looked through the code many times and I
Hi guys I after looking around I got the best solution. as #jia George point out you shold reset the inputstream after first decoding, the issue is that some time reset is not supported but you can wrap inputstream inside a BufferedInputStream and this one is fine.
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BufferedInputStream buffer=new BufferedInputStream(is);
BitmapFactory.decodeStream(buffer,null,options);
buffer.reset();
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth,reqHeight);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
BitmapFactory.decodeStream(buffer,null,options);