Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6045691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:09:11+00:00 2026-05-23T07:09:11+00:00

I have a Custom ListView created from XML Layout. I want to bind that

  • 0

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;
};

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:09:11+00:00Added an answer on May 23, 2026 at 7:09 am

    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.

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        final List<Sessions.Session> sessions = new Sessions().getSessions();
        setListAdapter(new BaseAdapter() {
    
            public int getCount() {
                return sessions.size();
            }
    
            public Object getItem(int pos) {
                return sessions.get(pos);
            }
    
            public long getItemId(int pos) {
                return pos;
            }
    
            public View getView(int pos, View view, ViewGroup viewGroup) {
                if (view == null) {
                    view = View.inflate(ViewTest.this, android.R.layout.two_line_list_item, null);
                }
    
                Sessions.Session session = (Sessions.Session) getItem(pos);
    
                TextView text = (TextView) view.findViewById(android.R.id.text1);
                text.setText(session.name);
    
                text = (TextView) view.findViewById(android.R.id.text2);
                text.setText(session.status);
                return view;
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom ArrayAdapter to display data within ListView items from an
I created a ListView with a custom layout for each view. I have several
I created a listview that has a custom SimpleCursorAdapter. I want to place a
i have created a custom dialog class public class NewPost extends Dialog { //
I have a custom CursorAdapter that is taking items from a database and displaying
I have 2 ways of displaying ListView data. I have a class for each
I have a listview from an SQLDatabase using custom CursorAdaptor. I would like to
I have a custom listview row that contains a number of textView components. Instead
I have a ListView in tile mode. I have created a custom method to
I have an Activity that retrieves data from a web service. This data is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.