Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to save images in cache memory in android

 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,


i am trying trying to download images from webservices which gives me base64 string(image),i was to save them in cache memory as bitmap so that evry time it wont take long time
to retrieve images and can look into the cache memory

iam developing my app in 2.1...so i cant use disk cache or lru cache

please suggest a good solution with some examples if possible..
thank you
 
Nick Johnson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this thing in higher version.... Android 2.3 or 4.0.....
Then tell, any improvement....?
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thankyou nick.

iam able to find many examples for versions above 2.3 but iam developing my app on 2.1...please some solution to save in cache in 2.1

should i try sql lite db
 
Nick Johnson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Try this:-

URL url = new URL(strUrl);
URLConnection connection = url.openConnection();
connection.setUseCaches(true);
Object response = connection.getContent();
if (response instanceof Bitmap) {
Bitmap bitmap = (Bitmap)response;
}
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks i try that...
but iam trying to retrieve binary(base64 image from webservice) will that code work???
i have no idea
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic