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

  • SEARCH
  • Home
  • 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 8804159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:31:55+00:00 2026-06-14T01:31:55+00:00

I have a custom list with name,age and grade .I want to loop through

  • 0

I have a custom list with name,age and grade .I want to loop through the list and show the contents in a table layout.Each row will have following attributes.Row will have some kind of styling

  Name,
   Age,
   Age_Value,
   Grade,
   Grade_Value

Here Age and Grades are just a label.Given below is a sample table

Dolly
Age
23
Grade
A+

Roman
Age
22
Grade 
C

Ben
Age
23
Grade
B+

I want to add these details to the Table layout in my layout dynamically.

Here is the code im trying

 for(int j=0;j<_attributeList.size();j++)
                      {

                          TableRow tr = new TableRow(MyActivity.this);
                          tr.setLayoutParams(new LayoutParams(
                                  LayoutParams.FILL_PARENT,
                                  LayoutParams.WRAP_CONTENT));

                              TextView tvName = new TextView(MyActivity.this);
                              tvName.setPadding(3,0,0,0);
                              tvName.setText(_attributeList.get(j).getName() +" : ");
                              tr.addView(tvName);

                              TextView tvAgeL = new TextView(MyActivity.this);

                              tvAgeL .setText("Age");
                              tr.addView(tvAgeL );

                              TextView tvAgeValue = new TextView(MyActivity.this);
                              tvAgeValue .setPadding(3,0,0,0);
                              tvAgeValue .setText(_attributeList.get(j).getValue() +" : ");
                              tr.addView(tvAgeValue );



                          attributeTable.addView(tr, new TableLayout.LayoutParams(
                                    LayoutParams.FILL_PARENT,
                                    LayoutParams.WRAP_CONTENT));
                     }
                    }

Since these items are adding to the same row im getting results in a single line. How can i show them in seperate rows

  • 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-14T01:31:56+00:00Added an answer on June 14, 2026 at 1:31 am

    You should try like this

    Code

    for(int i = 0; i < _attributeList.size();i++){              
    
        TableRow newRow = new TableRow(getApplicationContext());
        newRow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
    
        newCheckBox = new CheckBox(getApplicationContext());
    
        TextView feeTypeText = new TextView(getApplicationContext());
        feeTypeText.setText(jsonObj.getString("feeType"));
        feeTypeText.setTextColor(Color.BLACK);
        feeTypeText.setTextSize(16f);
        feeTypeText.setTypeface(tf);
    
        TextView dueAmountText = new TextView(getApplicationContext());
        dueAmountText.setText(jsonObj.getString("dueAmount"));
        dueAmountText.setTextColor(Color.BLACK);
        dueAmountText.setTextSize(16f);
        dueAmountText.setTypeface(tf);
    
        TextView dueDateText = new TextView(getApplicationContext());
        dueDateText.setText(jsonObj.getString("dueDate"));
        dueDateText.setTextColor(Color.BLACK);
        dueDateText.setTextSize(16f);
        dueDateText.setTypeface(tf);
    
        newRow.addView(newCheckBox,(new LayoutParams(0,LayoutParams.WRAP_CONTENT,0.8f)));
        newRow.addView(feeTypeText,(new LayoutParams(0,LayoutParams.WRAP_CONTENT,0.8f)));
        newRow.addView(dueAmountText,(new LayoutParams(0,LayoutParams.WRAP_CONTENT,1.0f)));
        newRow.addView(dueDateText,(new LayoutParams(0,LayoutParams.WRAP_CONTENT,1.0f)));
        attributeTable.addView(newRow);
    }
    
    • 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 list view, each row has it's own custom selector,
I have a list of my custom class(which has properties like Name,Age,Address).How can i
I have a list of my custom class(which has properties like Name,Age,Address).How can i
i have an employee table with fields like id, name, age and salary. Iam
I have subclassed SimpleCursorAdapter in order to create a custom list entry layout containing
I have Custom List to display image with it's name like below... public class
I want to implement custom JSP list tag, but have problem with accessing properties
In a a custom list view, I have a textview showing name and emailId.
I have created a sharepoint custom list. List items contains various fields like name,
I have a custom list menu style but I am unsure how to align

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.