Display Image Using A Rss Feed
Solution 1:
Best way to DISPLAY the image? I'm not sure if that's actually what you're asking, but just use an ImageView. Use an AsyncTask to download the image in the background, and then create a new Drawable from that downloaded image (might even want to cache it to storage) and set that as the source for the ImageView.
Solution 2:
there is a library for downloading and caching images in background from the URL https://github.com/koush/UrlImageViewHelperSample
=)
Solution 3:
Are you asking how to get the image URL from the XML RSS feed? There's nothing built into the SDK that's going to help you parse the XML, other than SAX or DOM which you have already noted. There is a learning curve to those, but they are reasonable approaches.
There's a project called ROME that is an API for robustly parsing all sorts of feeds, including RSS. You could import this library into your android app. Note that this library has other dependencies, so you'd have to import them also. I haven't done it personally, but I have heard of people using ROME in Android apps, so it's doable.
Or more simply, if you just want the image URL and you don't need a complete feed parser, you can use java.util.regex
to parse out the fields you want.
If you are asking how to display the image after you have the URL, kcoppock's answer explains it.
Post a Comment for "Display Image Using A Rss Feed"