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

The Archive Base Latest Questions

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

I got a program that has 50+ checkboxes on one page. And I need

  • 0

I got a program that has 50+ checkboxes on one page.
And I need to check which boxes are selected.

I know I can do somehting like this:

CheckBox cb1 = (CheckBox) findViewById(R.id.checkBox1);
CheckBox cb2 = (CheckBox) findViewById(R.id.checkBox2);

if (cb1.isChecked){
//get Checkbox name
}
if (cb2.isChecked){
//get Checkbox name
}

But if I have to do this with more then 50 checkboxes, that would take some time.
Is their a faster way to check which on is selected? Something like:

int i;

for (i = 0; i<checkBox.length; i++){
  CheckBox cb+i = (CheckBox) findViewById (R.id.checkBox+i);

     if (cb+i.isChecked){
     //get Checkbox name
     }
}

Maybe also good to say: you can select more then 1 checkbox.
I hope you know what I mean.

Thanks already,
Bigflow

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

    Another workaround may be:

    Suppose you have added CheckBox in LinearLayout and you can get the LinearLayout reference in Java and get the child Views like this:

    LinearLayout layout= (LinearLayout)findViewById(R.id.checkbox_container);
    ArrayList values = new ArrayList();
    for(int i=0; i<layout.getChildCount(); i++)
    {
        View v = layout.getChildAt(i);
        if(v instanceof CheckBox)
        {
            CheckBox cb = (CheckBox)v;
            if(cb.isChecked())
            values.add(cb.getText().toString());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a program that takes 3 arrays (which are the same length, can
I've got a program that periodically updates its database schema. Sometimes, one of the
I've got a small PyGTK program, that has a statusicon. Upon left click on
I've got a program that executes a method through a Thread.Start. The method has
So, I've got a custom class that has a __mul__ function which works with
i got a program that needs to check if a chunk of a file
I got a program that has a quite simple 'load up' function that takes
I've got a program I am working on that has multiple windows. The windows
I got a program that writes some data to a file using a method
So I've got a program that needs to be multilingual. The only difference between

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.