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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:09:20+00:00 2026-06-10T22:09:20+00:00

I have been reading tutorials and forum posts for the past few hours to

  • 0

I have been reading tutorials and forum posts for the past few hours to try and get a simple checkbox listview implemented.

I understand (i believe) how I need to maintain the state of my checkboxes in a list (o in my case a map).

It is such a simple thing I am sure but my checkbox is not being set to true or false in my bindView method. Here is the code

public void bindView(View view, Context context, Cursor cursor) {
        final int rowId = cursor.getInt(cursor.getColumnIndexOrThrow("_id"));

        familyText = (TextView)view.findViewById(R.id.contacts_row_family_name);
        markedBox = (CheckBox)view.findViewById(R.id.contacts_row_check);
        familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME)));



        view.setOnClickListener(new OnClickListener(){

            public void onClick(View arg0) {
                Log.d("OnClick","Row clicked");
                boolean currentlyChecked;

                if(checkedState.size() >= rowId){
                    currentlyChecked = checkedState.get(rowId);
                    checkedState.put(rowId, !currentlyChecked);
                }else{
                    currentlyChecked = false;
                    checkedState.put(rowId, !currentlyChecked);
                }

                markedBox.setChecked(checkedState.get(rowId));

            }

        });

        setProgressBarIndeterminateVisibility(false);


    }

Here is the declaration of checkedState. This is class member of my Activity.

private Map<Integer, Boolean> checkedState = new HashMap<Integer,Boolean>();

As far as I can make out I should have a listener on the row (this works because my Log message prints correctly) but the Checkbox doesn’t change.

  • 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-10T22:09:22+00:00Added an answer on June 10, 2026 at 10:09 pm

    Update:

    I was incorrect that my checkboxes weren’t being checked. Just the wrong one is being checked. I will close this question.

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

Sidebar

Related Questions

I am currently trying to learn Android. Have been reading tutorials and manual for
I have been reading through lots of Q&A everywhere and these stackoverflow posts seem
Over the past week or so I have been reading a lot of articles
I have been trying to set up OpenCV for the past few days with
I have been reading several tutorials and watching some iTube videos to see how
I have been at this for quite some time now, reading tutorials and so
I have been reading tutorials from several different places like http://css-tricks.com/scrollfollow-sidebar/ or http://jqueryfordesigners.com/fixed-floating-elements/ and
I have been reading several jQuery tutorials on the web. They all seem very
I've been reading some tutorials on how to get started using Rails 2.0. (Time
I have been reading a number of tutorials on implementing Structure Map IoC/di into

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.