I am trying to parse the images that are display in this link http://lawncare.ncsu.edu/RSSFeed.aspx and display it in an android device. Right now, I am only able to parse the text associated with the images. Can anyone suggest any ideas on how to go about parsing these images? Preferably not using JSoup because I am already half way down the code.
Asked
Active
Viewed 324 times
1 Answers
0
Try looking at this question over here at : How to parse XML using the SAX parser
specifically the answer given by damiean and his solution.
This is a part of my code where i am parsing the rss feed :
Bundle b = new Bundle();
b.putString("title", feed.getItem(position).getTitle());
b.putString("description", feed.getItem(position).getDescription());
b.putString("content", feed.getItem(position).getContent());
b.putString("link", feed.getItem(position).getLink());
b.putString("pubdate", feed.getItem(position).getPubDate().toString());
What i have done is that the "field" contains both the description(text) and the image . I passed the whole "content" field contents into a WebView and it displays the image as well as the text correctly.

Community
- 1
- 1

Android2390
- 1,150
- 12
- 21
-
I have used his method to parse through the page. But the problem is, the img src is present inside the
tag. The text gets displayed. But not the images. – user1454068 Jul 31 '12 at 17:21 -
Okay the only solution i can think of is to take the content inside the
tag and copy it into a string and then parsing it to find the " – Android2390 Jul 31 '12 at 17:43" tag and then passing it to the bitmap into an imageview OR copying the full content inside the "
" tag and then passing it into a webview -
I'm sorry, but could you please elaborate more? Also, if you have displayed the contents in a WebView, are you using the browser to display the contents? Because I would not like to do so. – user1454068 Jul 31 '12 at 17:47
-
Yes, that is exactly what I am trying to do. But there are three img src tags and i am able to get hold of only the first one! – user1454068 Jul 31 '12 at 17:50
-
Yes i am using a WebView to display all the contents . The rss feed link is as seen here : http://www.pencilsofpromise.org/feed So what i do is i take all the contents inside of the "content" tag and load it into the webview but since you want an object inside of an object i am not really sure of how to do it in the XML parser but i did a similar kind of thing with the twitter feed and over there i did this : JSONObject obj = samplearr.getJSONObject(index); JSONObject userobj = samplearr.getJSONObject(index).getJSONObject("user"); – Android2390 Jul 31 '12 at 18:03
-
This way i am getting a object within an object. Not sure if this helps you though because i am giving you the example of a JSONObject :) – Android2390 Jul 31 '12 at 18:06
-
Try this link over here : http://stackoverflow.com/questions/1253788/simple-rss-parser-for-android – Android2390 Jul 31 '12 at 18:08
-
Hmmm...this may seem a little off topic...but can I use WebView to parse the page and display it in the app? – user1454068 Jul 31 '12 at 18:31