开发者

Android add different icons to a list

开发者 https://www.devze.com 2023-02-19 06:29 出处:网络
I am getting RSS feeds from two different URLs (Say twitter and Facebook). I want to add these two to the same list and add their respective icons. I have tried many things.

I am getting RSS feeds from two different URLs (Say twitter and Facebook). I want to add these two to the same list and add their respective icons. I have tried many things.

The below code is for parsing

Element _titleE = (Element) entry.getElementsByTagName("description").item(0);

                        String _title = _titleE.getFirstChild().getNodeValue();
                          _linkE.getFirstChild().getNodeValue();

                        RssItem rssItem = new RssItem(_title);
                        rssItems.add(rssItem);

Here is how I'm adding it to the array adapter 开发者_如何转开发to display. The image which is there in R.id.Label gets set (it is present in XML).

aa = new ArrayAdapter<RssItem>(this, R.layout.list_item,R.id.label, rssItems);
            rssListView.setAdapter(aa);


I had the same issue some days before and got help from this tutorial: http://www.anddev.org/android_filebrowser__v20-t101.html They are basically implementing a custom adapter which creates the list items and sets their icons.

0

精彩评论

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