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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:55:46+00:00 2026-06-13T01:55:46+00:00

I have added a checkbox to the Listview and managed to get the checkbox

  • 0

I have added a checkbox to the Listview and managed to get the checkbox listener using a custom adapter. Everything is working except that the listview item click Listener is not getting focused at all.

Here is my Code:

public class MyCursorAdapter extends SimpleCursorAdapter {

private Cursor c;
private Context context;
int selectCount;

public MyCursorAdapter(Context context, int layout, Cursor c,
        String[] from, int[] to) {
    super(context, layout, c, from, to);
    this.c = c;
    this.context = context;

}

public View getView(int pos, View inView, ViewGroup parent) {
    View v = inView;
    if (v == null) {
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = inflater.inflate(R.layout.row_bookmark, null);
    }
    c.moveToFirst();

    c.moveToPosition(pos);

    TextView title = (TextView) v.findViewById(R.id.title);
    title.setText(this.c.getString(this.c.getColumnIndex("title")));
    TextView details = (TextView) v.findViewById(R.id.details);
    details.setText(this.c.getString(this.c.getColumnIndex("date")));

    final CheckBox cb = (CheckBox) v.findViewById(R.id.checkBox1);
    cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView,
                boolean isChecked) {

            if (cb.isChecked()) {
                if (cb.isClickable()) {
                    selectCount = selectCount + 1;
                }
            } else if (!cb.isChecked()) {
                if (cb.isClickable()) {
                    if (selectCount > 0)
                        selectCount--;
                }
            }

            // if any item is checked display the actionMode
            if (selectCount == 1) {
                BookmarkActivity.startmode();
            }
            if (selectCount == 0) {
                BookmarkActivity.stopmode();
            }
            if (selectCount != 0)
                BookmarkActivity.mMode.setTitle(selectCount + "    selected");
        }

    });
return (v);
}

}

  • 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-13T01:55:46+00:00Added an answer on June 13, 2026 at 1:55 am

    Can you try adding the following line in the XML where you have declared the checkbox :

        android:focusable="false"
    

    I had encountered this myself and after disabling the focus everything worked well.

    Let me know if it works out for you.

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

Sidebar

Related Questions

I have a custom cursor adapter I'm using to fill a ListView. The inflater
I have a gridview that I have added a checkbox column using a templatefield
I have added checkbox in display table using decorator class as shown in below
I am using Facebook registration plugin. And I added a checkbox field that I
I have added a checkbox to the rows of a gridview that when clicked
I have the custom Listview. there are two textboxes and a checkbox. Xml files
I have a ListView with a custom adapter. It countains CheckBoxes. When one of
I'm working on a ListView that uses a custom ResourceCursorAdapter to display a TextView
I have added checkbox selection model to grid panel. It works fine in IE8
I have added a plugin called scrollpaper to a site I'm working on. 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.