开发者

The easiest way to download a picture from a web page in an Android application?

I want to pick out the last 5 images (including explanatory text) from http://nucleum.tumblr.com/ and display each image on a new page with the ability to navigate between them in an Android app. Can be compared with http://www.appbrain.com/app/elvis-the-comic/s开发者_运维知识库e.oscar.elvisthecomic that retrieves images from elvisthecomic.com/

How do I make it? Any examples?


If the structure of the HTML is relatively stable, you could retrieve it, look for the tag and the text under it, and download them. You could use afterwards a Galery to display them


That page has an associated RSS feed in Atom format, at http://nucleum.tumblr.com/rss - that'd be more reliable to work from than scraping the HTML.

You could read some of the excellent RSS-parsing related answers here on SO (E.g. https://stackoverflow.com/questions/1253788/simple-rss-parser-for-android) for examples on how to handle that.

You'd then need to download each image; That should be done on a background thread to avoid your whole app freezing up until all the data are loaded. Again, there are some informative threads (no pun intended!) here on SO : Downloading images in background while showing the listview

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜