I’m writing an android RSS feed reader.
when my program read the feeds at the end return me an ArrayList
Item is my class:
public class Item implements Serializable {
private String title;
private String description;
private String link;
public Item() {
setTitle(null);
setDescription(null);
setLink(null);
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
}
Now how can I populate a custom ListView that has 3 TextView in it for Title, description and link?
You don’t need to write a custom ListView. You should use a personalized layout and custom adapter.
First, write a layout to define how each row should look. Here’s a basic example:
(Save it as
list_item.xmlin yourres/layoutfolder.)Next, I recommend that you create a custom adapter to efficiently display your layout:
To learn more about custom adapter’s, ViewHolders, and efficiency please watch Android’s Romain Guy talk on this subject.
Hope that helps!