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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:40:40+00:00 2026-06-12T04:40:40+00:00

I know there’s tons of other threads around about this same topic, but none

  • 0

I know there’s tons of other threads around about this same topic, but none of them seem to work with my scenario and I couldn’t get my listview to work with their code. Basically, I’m using a SimpleCursorAdapter to populate a listview with items from the database. Each listview row uses a custom layout which consists of a checkbox and a line of simple text. How do I detect a click on the checkbox? I know I need to use OnItemClickListener, but I don’t know how to incorporate that into my code. Here’s my code:

remindersCursorAdapter = new SimpleCursorAdapter(this,
                         R.xml.view_reminders_item_layout,
                         remindersCursor, new String [] { RemindersDAO.NAME },
                         new int[] { R.id.view_reminders_item_text } );

viewRemindersListView.setAdapter(remindersCursorAdapter);

R.xml.view_reminders_item_layout is the custom listview layout file. How do I capture the checkbox from this file and set a click listener to it? Thanks for all your help!

  • 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-12T04:40:41+00:00Added an answer on June 12, 2026 at 4:40 am

    If you want to check the checkbox when a item is clicked, you can do it by setting checked status of Checkbox in onItemClick method.

      @Override
      public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    
           // now get the checkbox view. Then set the checked status.
            CheckBox checkbox = (CheckBox) view.findViewById(R.id.check_box);
            checkBox.setChecked(!checkbox.isChecked());
      }
    

    If you want to detect the click on only checkbox then set the focusable true in xml.
    // in your custom list view item. It takes the current view focus.

          <Checkbox>
              android:focusable="true"
          </Checkbox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there are several topics out there about this, but none of them
I know there are similar questions already on SO but none of them seem
I know there are dozens of questions that ask about this error, but none
I know there are many threads that talk about this problem but I don't
I know there have been quite a few posts on this but none seem
I know there a lot of questions about this, but neither one of them
I know there is a lot on this topic but I can't get any
I know there are a lot of questions around on this subject, but I've
I know there is another question about this here but this just isn't working
I know there are lot of threads about regex and dollar signs. But the

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.