I am not able to find that how to store image into cache memory by using url of the image...is there any way to do this...Please help me to do this..thanks in advance
Asked
Active
Viewed 126 times
-1
-
1use the glide library to cache image here is a good tutorial https://futurestud.io/tutorials/glide-caching-basics – Bruno Ferreira Jul 26 '17 at 19:59
-
Theres some good info about this here; https://stackoverflow.com/questions/37699688/cache-images-local-from-google-firebase-storage – hlovyak Jul 26 '17 at 19:59
1 Answers
0
You can very simply implement a bitmap factory with you web service calls.
As an example:
public static Bitmap getBitmapFromURL(String src) {
try {
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
// Log exception
return null;
}
}

anomeric
- 688
- 5
- 17