0

I am doing Doing Dom Parsing from a news website for my android project. But i am finding a trouble.

I want to print the title element of the item tag (main tag).. in the list. And i did it. but i want when i click on the list item the corresponding data (example link, publishdate, title, description) will print in the next intent.For printing the titles in the list only titles of the items came in the array that i am pouring in the list.The remaining data is not coming in the array. So i am confusing in this problem. Can anybody suggest me appropriate suggestion.

Code for printing titles in the list is following :-

Here "messages" is a list. and "msg" is the object of Message class which has getter nd setter method.

    loadFeed(){
    try{
        BaseFeedParser parser = new BaseFeedParser();
        messages = parser.parse();
        List<String> titles = new ArrayList<String>(messages.size());
        for (Message msg : messages){
            titles.add(msg.getTitle());
        }
        ArrayAdapter<String> adapter = 
            new ArrayAdapter<String>(this, R.layout.row,titles);
        this.setListAdapter(adapter);
    } catch (Throwable t){
        Log.e("BBCNews",t.getMessage(),t);
    }
foxy
  • 7,599
  • 2
  • 30
  • 34
Rana.S
  • 2,265
  • 3
  • 20
  • 19

1 Answers1

0

I see that you use the BaseFeedParser class, so I guess, you started with this article.

The missing data is in the Message object. Actually you just pass the title strings to your array adapter. So now, if you touch one of the titles, you have to (1) get the selected title and (2) look up the corresponding Message object for that title. Then you use this Message object to feed your new intent.

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
  • i have solved this problem. I used Vector to store my data. and used putextra() method to send data on next activity while clicking on the item in list body.. – Rana.S Jun 22 '11 at 05:49