Android, how to lazy load images from url and persistently cache them in gallery widget? [closed]

旧巷老猫 提交于 2019-12-18 03:39:14

问题


I'm implementing an Android gallery widget. I'm asking how to lazy (i.e. in a separate thread) load images from the web and persistently cache them? So that on the next run I have the cached images locally available...


回答1:


This is how:

Lazy load of images in ListView

Check the demo in the second answer, helped me massively!




回答2:


Try this code.the universal imageloader.

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




回答3:


Try to use this tutorial Android: Help in adapting ListView adapter with an ImageLoader Class (LazyList)

Hope, it's helps you!.




回答4:


    You have to use Picasso. 

    it's easy to use

    downlod latest jar from  http://square.github.io/picasso/

    simply load image used below code

    Picasso.with(context)
               .load(url)
               .placeholder(R.drawable.placeholder)
               .resize(imgWidth, imgHeight)
               .centerCrop()
               .into(image);


来源:https://stackoverflow.com/questions/6125754/android-how-to-lazy-load-images-from-url-and-persistently-cache-them-in-gallery

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