I am retrieving images from a url. Instead of caching the images, would it by any chance be possible to store it in a SQLite database?
/**
ya you can store image as BLOB in your database,
public static byte[] urlToImageBLOB(String url) throws IOException {
httpclient = new DefaultHttpClient();
entity = null;
httpGet = new HttpGet(url);
response = httpclient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
entity = response.getEntity();
}
return EntityUtils.toByteArray(entity);
}
To fetch
public static Bitmap getImageFromBLOB(byte[] mBlob) {
byte[] bb = mBlob;
return BitmapFactory.decodeByteArray(bb, 0, bb.length);
}
// to set imageView.setImageBitmap(getImageFromBLOB(cursor.getBlob(object.getColumnIndex("book_thumb"))));