Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does facebook or instagram app retain images or data after entering the app with no internet connection?

In Facebook app, for example, I login with my internet connection. Then I close the app, turn off the internet and close all my system tabs. Then even though my internet connection is off, I see the images and data that had been previously loaded still retained.

How does Facebook app do that? What should I do if wanted to implement such a feature in my Android app?

like image 791
Shababb Karim Avatar asked Jul 12 '16 12:07

Shababb Karim


1 Answers

i use 'Picasso' Library for caching, loading... images from internet :

http://square.github.io/picasso/

Automatic memory and disk caching

Picasso.with(context)
   .load(url)
   .resize(50, 50)
   .centerCrop()
   .into(imageView)

for data, you can store data using shared preferences for small stuff or a local database like sqlite

like image 183
Mounir Elfassi Avatar answered Oct 31 '22 19:10

Mounir Elfassi