File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes how to save images in cache memory in android Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "how to save images in cache memory in android" Watch "how to save images in cache memory in android" New topic
Author

how to save images in cache memory in android

Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 214
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

Joined: Jun 21, 2012
Posts: 16
Try this thing in higher version.... Android 2.3 or 4.0.....
Then tell, any improvement....?
Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 214
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

Joined: Jun 21, 2012
Posts: 16

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

Joined: Feb 10, 2012
Posts: 214
thanks i try that...
but iam trying to retrieve binary(base64 image from webservice) will that code work???
i have no idea
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to save images in cache memory in android