I am using this method to retrieve a bitmap
private Bitmap getBitmap(String url)
{
File f=fileCache.getFile(url);
//from SD cache
if(b!=null)
return b;
//from web
try {
Bitmap bitmap=null;
Log.e("URL", url);
URL imageUrl = new URL(url);
HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
conn.setConnectTimeout(30000);
conn.setReadTimeout(30000);
InputStream is=conn.getInputStream();
OutputStream os = new FileOutputStream(f);
Utils.CopyStream(is, os);
os.close();
return bitmap;
} catch (Exception ex){
ex.printStackTrace();
return null;
}
}
As you see above how do i decode the bitmap from SDcard or cache and from the get from web code? Ive tried one method but it didnt work.