I have a Custom ListView created from XML Layout. I want to bind that to my Custom Data Class.
How do i Convert that class to a ListAdapter and bind the layout to the ListView. The Code of the class is as Follows:
public class Sessions {
private int status;
private List<Session> sessions;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public List<Session> getSessions() {
return sessions;
}
public void setSessions(List<Session> sessions) {
this.sessions = sessions;
}
public static class Session {
public Boolean active;
public String contributor_covu_id;
public String created_at;
public String key;
public String status;
public String name;
public String type;
};
}
Create an Activity based on ListActivity and use something like what’s below in your onCreate. It’ll make a list with a simple two line layout for each row and set the text to the session name and session status.