Android: Download images from web and show them on gridview

有些话、适合烂在心里 提交于 2020-01-02 20:10:49

问题


I want to create a program that gets some images from a webpage, and shows them on a gridview. I dont know how many of them exactly. It could be from 20 to 30. Ill do it with asynctask, which i have allready used before and more or less know how it works. But i don't know which way use it this time.

For now, what i would like to get is a progressbar (circle clicking) while image is downloading. And once its downloaded, it would disappear and image will load. I will use an array of objects with an adapter, to fill the gridview.

Which way would you use the asynctask?

Thanks in advance.


回答1:


I would suggest you check out Lecture 6 of Harvard Extension CS76. There is a URLImageAdapter and example source code that does example what you are looking for.

Best of luck




回答2:


If you want to save downloaded images and reuse them in future then you must look DownloadManager

To display dialog with cycling circle, look this: howto use ProgressDialog



来源:https://stackoverflow.com/questions/6319478/android-download-images-from-web-and-show-them-on-gridview

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