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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:37:54+00:00 2026-06-12T21:37:54+00:00

I have a listview with a checkboxes in each row. I am using the

  • 0

I have a listview with a checkboxes in each row. I am using the viewholder pattern to load the list, like this:

View view = convertView;
        if(view == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.setting_list_item, null);

            ViewHolder viewHolder = new ViewHolder();
            viewHolder.cbCat = (CheckBox) view.findViewById(R.id.cbCat);

            view.setTag(viewHolder);
        }
        ViewHolder vh = (ViewHolder) view.getTag();
        vh.cbCat.setText(bt.getName());

But when I try to get the checked checkboxes, like this :

for(int i = lvCatList.getFirstVisiblePosition(); i < settingAdapter.getCount(); i++) {
            View v = lvCatList.getChildAt(i);
            CheckBox cbx = (CheckBox) v.findViewById(R.id.cbCat);

            if(cbx != null && cbx.isChecked()) {
                toast += " / " + settingAdapter.getItem(i).getName();
                Log.d("CHECKED", toast);
            }

Only the visible checkboxes can be get. And if the checkbox is not visible in the screen it throws exceptions.

How to check whether the chekboxes in the list are checked or not.?
}

  • 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-12T21:37:55+00:00Added an answer on June 12, 2026 at 9:37 pm

    You can add selected checkbox value to arraylist when checking on checkbox

    List<String> SelectedBox = new ArrayList<String>();
    
    View.setOnCheckedChangeListener(new OnCheckedChangeListener()
    {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
        {
            if(isChecked)
                {
                    SelectedBox.add(id);
                }
                else
                {
                    SelectedBox.remove(id);
                }
        }
    });
    

    When you need to check whether the checkbox is checked just refer SelectedBox

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom ListView in which each row.xml looks like this: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have a ListView with multiple checkboxes (one for each list item). What would
Currently I have a list view within it each row has a checkbox attached.
I have a listview with each row having a checkbox, imageview and text view
I have a listView multichoice, Each row of list have a checkbox. And I
I have created listview using layoutinflator. Listview contains checkbox and textview for each row.
I have a ListView, checkboxes = true, View = List. On the start of
I have created one listview, in this each row contain check box and the
i have a listview with checkbox in each rows. i'm using custom cursoradapter and
I want a list view control (or any list like control) in which each

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.