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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:58:12+00:00 2026-06-12T05:58:12+00:00

i want to create like this. my code is.. void fillCountryTable() { TableRow row;

  • 0

i want to create like this.enter image description here

my code is..

void fillCountryTable() {
  TableRow row;
  TextView tv_lession, tv_price, tv_line;
  CheckBox chkbox;

  int dip = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
    (float) 1, getResources().getDisplayMetrics());

  for (int current = 0; current < lession.size(); current++) {
   row = new TableRow(this);

   TableRow.LayoutParams llp = new TableRow.LayoutParams(
     );
   llp.setMargins(2, 2, 2, 2);// 2px right-margin

   // New Cell
   LinearLayout cell = new LinearLayout(this);

   cell.setBackgroundColor(Color.BLUE);
   cell.setLayoutParams(llp);// 2px border on the right for the cell

   tv_lession = new TextView(this);
   tv_lession.setTextColor(getResources().getColor(color.darker_gray));
   tv_price = new TextView(this);
   tv_price.setTextColor(getResources().getColor(color.darker_gray));
   chkbox = new CheckBox(this);
   chkbox.setId(current);

   tv_lession.setText(lession.get(current));
   tv_price.setText(price.get(current));

   tv_lession.setTypeface(null, 1);
   tv_price.setTypeface(null, 1);

   tv_lession.setTextSize(15);
   tv_price.setTextSize(15);

   tv_lession.setWidth(50 * dip);
   tv_price.setWidth(150 * dip);
   chkbox.setWidth(50 * dip);
   tv_lession.setPadding(20 * dip, 0, 0, 0);

   cell.addView(tv_lession);
   cell.addView(tv_price);
   cell.addView(chkbox);

   // row.setBackgroundColor(color.black);
   row.addView(cell);

   ((TableLayout) findViewById(R.id.course_outline_table)).addView(
     row, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,
       LayoutParams.WRAP_CONTENT));

   chkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

    public void onCheckedChanged(CompoundButton buttonView,
      boolean isChecked) {
     if (isChecked) {
      subTotal += Integer.parseInt(price.get(buttonView
        .getId()));
      total = subTotal + tax;
     } else {
      subTotal -= Integer.parseInt(price.get(buttonView
        .getId()));
      total = subTotal + tax;
     }

     ((TextView) findViewById(R.id.tv_subTotal))
       .setText(subTotal + "");
     ((TextView) findViewById(R.id.tv_total))
       .setText(total + "");
    }
   });

  }
 }
  • 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-12T05:58:14+00:00Added an answer on June 12, 2026 at 5:58 am

    Check this Solution:

            TableRow row;
    
            shoppingCardDetails = new ArrayList<ShoppingCardDetails>();
    
            SoapObject courseOutlineObject = (SoapObject) ParserClass.ResponseVector
                    .elementAt(3);
    
            final Vector courseOutline = (Vector) courseOutlineObject
                    .getProperty(0);
            //System.out.println(courseOutline);
            //System.out.println("check record" + courseOutline.size());
            for (int current = 0; current < courseOutline.size(); current++) {
    
                try {
    
                    row = (TableRow) LayoutInflater.from(this).inflate(
                            R.layout.table_row, null);
                    chkbox = (CheckBox) row.findViewById(R.id.chkBox);
                    chkbox.setId(current);
    
                    ((TextView) row.findViewById(R.id.coursename))
                            .setText(((SoapObject) courseOutline.elementAt(current))
                                    .getProperty("tocName").toString());
    
                    ((TextView) row.findViewById(R.id.tvcourseprice))
                            .setText(((SoapObject) courseOutline.elementAt(current))
                                    .getProperty("tocPrice").toString());
    
                    /*
                     * if ((((SoapObject) courseOutline.elementAt(current))
                     * .getProperty("tocLevel") + "").equalsIgnoreCase("0")) {
                     * 
                     * ((LinearLayout) row.findViewById(R.id.llrow))
                     * .setBackgroundColor(Color.parseColor("#F2F5A9"));
                     * 
                     * }
                     */
                    if ((((SoapObject) courseOutline.elementAt(current))
                            .getProperty("tocEnrollStatus") + "")
                            .equalsIgnoreCase("true")) {
    
                        chkbox.setVisibility(View.INVISIBLE);
                        ((TextView) row.findViewById(R.id.tvEnrolled))
                                .setVisibility(View.VISIBLE);
                        ((TextView) row.findViewById(R.id.tvcourseprice))
                                .setVisibility(View.VISIBLE);
    
                    }
    
                    ((TableLayout) findViewById(R.id.course_outline_table))
                            .addView(row);
    
                    chkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
    
                        @overide
                        public void onCheckedChanged(CompoundButton buttonView,
                                boolean isChecked) {
    
                            try {
                                ShoppingCardDetails shoppingdetails = new ShoppingCardDetails();
    
                                if (isChecked) {
    
                                    subTotal += 1;
                                    total = subTotal;
                                    shoppingdetails.name = ((SoapObject) courseOutline
                                            .elementAt(buttonView.getId()))
                                            .getProperty("tocName").toString();
                                    shoppingdetails.price = ((SoapObject) courseOutline
                                            .elementAt(buttonView.getId()))
                                            .getProperty("tocPrice").toString();
                                    shoppingCardDetails.add(shoppingdetails);
    
                                } else {
                                    subTotal -= 1;
                                    total = subTotal;
    
                                    shoppingCardDetails.remove(total);
    
                                }
    
                                ((TextView) findViewById(R.id.btnRightHeader))
                                        .setText("" + total);
    
                                ((TextView) findViewById(R.id.btnRightHeader))
                                        .setPadding(30, 0, 0, 15);
                                ((TextView) findViewById(R.id.btnRightHeader))
                                        .setTextColor(Color.WHITE);
    
                            } catch (Exception e) {
                                // TODO: handle exception
                            }
                        }
                    });
                } catch (Exception e) {
                    // TODO: handle exception
                }
    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a link like this: <a href=http://example.com>text</a> and replace the behavior
I want to create an application like this: http://collabedit.com/ What is the most efficient
I want to create an AlertDialog like this : I know that a blue
I want to create an extension method like this public static bool AllConsecutives(this IEnumerable<int>
I want to create a JSF table like this . But instead delete button
I want to create a ordered html list like this: 1.0 Introduction 1.1 Features
I want to create a vertical line shadow over the whole page like this:
Imagine that I want to create an array from another array like this: $array
So I have Html like this http://trac.edgewall.org/wiki/RecentChanges (I want to create some Flash Track
I want to create a custom button in ActionScript. This is my code: import

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.