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 8261477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:25:24+00:00 2026-06-08T03:25:24+00:00

This is what I have so far: The Custom Object: class ItemObject { List<String>

  • 0

This is what I have so far:

The Custom Object:

class ItemObject {
    List<String> name;
    List<String> total;
    List<String> rating;

public ItemObject(List<ItemObject> io) {
    this.total = total;
    this.name = name;
    this.rating = rating;
 }
}

The Call to the Adapter:

List<String> names, ratings, totals;

ItemObject[] io= new ItemObject[3];
io[0] = new ItemObject(names);
io[1] = new ItemObject(rating);
io[2] = new ItemObject(totals);

adapter = new ItemAdapter(Items.this, io);
setListAdapter(adapter);

Assuming the above looks ok, my questions is how would I set up the ItemAdapter, it’s constructor, and unwrap the three List’s from the object. And then, in the getView, assign these things:

each matching position to:

    TextView t1 = (TextView) rowView.findViewById(R.id.itemName);
    TextView t2 = (TextView) rowView.findViewById(R.id.itemTotal);
    RatingBar r1 = (RatingBar) rowView.findViewById(R.id.ratingBarSmall);

For example, position 0 in the array “names” to t1.
Position 0 in the array “totals” to t1.
Position 0 in the array “ratings” to r1.

EDIT: I don’t want someone to write the entire Adapter. I just need to know how to unwrap the Lists from the Custom Object so I can use the data. (Something not even brought up or asked about in another question)

  • 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-06-08T03:25:25+00:00Added an answer on June 8, 2026 at 3:25 am

    Your code will not work in its actual form. Do you really need lists of data in the ItemObject? My guess is no and you simply want a ItemObject that holds 3 Strings corresponding to the 3 views from your row layout. If this is the case:

    class ItemObject {
        String name;
        String total;
        String rating;// are you sure this isn't a float
    
    public ItemObject(String total, String name, String rating) {
        this.total = total;
        this.name = name;
        this.rating = rating;
     }
    }
    

    Then your lists will be merged into a list of ItemObject:

    List<String> names, ratings, totals;
    ItemObject[] io= new ItemObject[3];
    // use a for loop
    io[0] = new ItemObject(totals.get(0), names.get(0), ratings(0));
    io[1] = new ItemObject(totals.get(1), names.get(1), ratings(1));
    io[2] = new ItemObject(totals.get(2), names.get(2), ratings(2));
    adapter = new ItemAdapter(Items.this, io);
    setListAdapter(adapter);
    

    And the adapter class:

    public class ItemAdapter extends ArrayAdapter<ItemObject> {
    
            public ItemAdapter(Context context,
                    ItemObject[] objects) {
                super(context, 0, objects);         
            }
    
            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                // do the normal stuff
                ItemObject obj = getItem(position);
                // set the text obtained from obj
                        String name = obj.name; //etc       
                        // ...
    
            }       
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom class class RouteStop { public int number; public string location;
I have created a custom Base Adapter class, to populate a list view with
I have this so far but the Column 'name' is ambiguous, so I want
This is what I have so far - my dropbox public URL creation script
I have custom exceptions in my django project that look like this: class CustomFooError(Exception):
This is my custom model binder code for the BaseContentObject class: public class BaseContentObjectCommonPropertiesBinder
I have a custom object with several properties, one of which returns a list.
I have this so far but I don't know how to write over the
I have this so far: http://jsfiddle.net/u5vhS/54/ . What I want to be able to
So far i have this: mov ah,02h mov cl,11001100001111011101000b ;6,692,584 in dec mov dl,0

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.