I am using following method to download image from URL
private Bitmap getBitmap(String url)
{
File f=fileCache.getFile(url);
Log.d("getBitmap", "getBitmap"+url);
//from SD cache
Bitmap b = decodeFile(f);
if(b!=null)
return b;
//from web
try {
Bitmap bitmap=null;
URL imageUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
conn.setConnectTimeout(30000);
conn.setReadTimeout(30000);
conn.setInstanceFollowRedirects(true);
InputStream is=conn.getInputStream();
OutputStream os = new FileOutputStream(f);
Utils.CopyStream(is, os);
os.close();
bitmap = BitmapFactory.decodeStream(is);
return bitmap;
} catch (Exception ex){
ex.printStackTrace();
return null;
}
}
for me this method is working well for all URLs which correspond to an Image But the problem is that it does not work for following
http://downloads.hyperin.com/hyperin-portal/imageserver/news/13442/ginatricot.jpg
Working well for following url
http://downloads.hyperin.com/hyperin-portal/imageserver/news/12042/Myfit_liity_nyt.jpg
For debugging i opened image in browser and downloaded it on my PC checked its properties and figured out that this is 32 bit Image and other images which are downloaded successfully are 24 bit. I don't know why same code cannot download 32 bit image which is successfully downloading 24 bit image. I my code missing something? Does android not support 32 bit Images? Or What? Please Suggest me figuring out solution