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

只谈情不闲聊 提交于 2019-12-04 10:13:25

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

You can cache these images ( saving them locally ) - there are multiple ways to do so. Some image loading libraries are doing this - or you can do this on the transport-layer ( e.g. with okhttp )

There are so many image caching libraries. Such as Picasso,Volley,Universal image loader and so on.Refer these links.

https://github.com/nostra13/Android-Universal-Image-Loader

https://developer.android.com/training/volley/request.html

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

Simply they have disk cache, if you open Facebook Android App and go Open Source Libraries part you will see they using DiskLruCache . And if you check Facebook App size in Applications its growing everyday. Also you can use mobile database like Sqlite or Realm etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!