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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:28:46+00:00 2026-06-14T23:28:46+00:00

I have a listview with some text and a checkbox. I can click the

  • 0

I have a listview with some text and a checkbox. I can click the checkbox, and the check changes, but when I try to listen for the check being changed, or the click, the listener never triggers.

I have the listview in an Activity (not a ListActivity)

schedule.xml layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:id="@+id/schedulerLayout">
<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center"
        android:paddingBottom="10dp">
    <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="horizontal">
        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/currentHours"
                android:textSize="50dp"/>
        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="50dp"
                android:text=":"/>
        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/currentMinutes"
                android:textSize="50dp"/>
    </LinearLayout>
    <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:orientation="vertical">
        <!--vertical filler for am/pm display -->
        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>
        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/ampm"/>
    </LinearLayout>
    <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:paddingLeft="10dp"
            android:orientation="vertical">
        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/currentDayOfWeek"/>
        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/currentDate"/>
    </LinearLayout>
</LinearLayout>

<Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/scheduleButton"
        android:text="@string/newSchedule"/>
<View
        android:layout_width="fill_parent"
        android:layout_height="1dip"
        android:background="#FFFFFFFF"/>

<ListView
        android:id="@+id/scheduler_list_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:focusable="false"
        android:focusableInTouchMode="false"/>
</LinearLayout>

schedulerow.xml:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true">
<TextView
        android:id="@+id/scheduleListTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textStyle="bold"
        android:layout_alignParentTop="true"
        android:text="Title"/>

<TextView
        android:id="@+id/scheduleListDays"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/scheduleListTitle"
        android:text="Days"/>
<TextView
        android:id="@+id/scheduleListMonths"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/scheduleListDays"
        android:text="Months"/>
<View
        android:id="@+id/schedulerSeparator"
        android:layout_width="fill_parent"
        android:layout_height="1dip"
        android:background="#FFFFFFFF"
        android:layout_below="@id/scheduleListMonths"/>
<CheckBox
        android:id="@+id/scheduleCheckBox"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:clickable="true"
        android:layout_above="@id/schedulerSeparator"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"/>
<TextView
        android:id="@+id/scheduleListTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/scheduleCheckBox"
        android:text="Time"/>
</RelativeLayout>

I’m filling in the data like this:

SimpleAdapter adapter = new SimpleAdapter(this,
            data,
            R.layout.schedulerow,
            new String[] {"Title","Time","Day", "Month"},
            new int[] { R.id.scheduleListTitle, R.id.scheduleListTime,R.id.scheduleListDays, R.id.scheduleListMonths});

listView.setAdapter(adapter);

If I try to add a listener to the checkbox, it does nothing. Any suggestions? I’ve looked through a TON of sample code and similar questions, and none of it seems to work.

  • 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-14T23:28:48+00:00Added an answer on June 14, 2026 at 11:28 pm

    One solution is to forget the list item click listener and use another listener for the rest of the item other than the checkbox.. In item layout xml, put the other views in single layout and set the click listener on this and set the check listener on checkbox as usual. Both will work without issues. Dont use the list item click listener.

    class MySimpleAdapter extends SimpleAdapter {
     ... 
       @Override
       void getView(.....) {
           View view = super.getView(.....);
           view.findViewById(R.id.checkboxid).setOnCheckChangedListner(checklistener);
           view.findViewById(R.id.restOfitemview).setOnClickListner(clickListner);
           return view;
        }
    }
    

    Define the two listeners and set as shown above.

    Edit : First try your method(blocking focus on checkbox) with the MySimpleAdapter setting only the checkchangelistener.. If that does not work then use above solution of dividing the item layout.

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

Sidebar

Related Questions

I have listview having customized some textview and one imageview. When I long click
I have some spinner in a ListView(Left side some text and righ side spinner)
i have the problem about when user click the checkbox inside the listView ,
I have an Android ListView with rows that include one checkbox, and four text
I have a listview with each row containing some text and a delete button.
I have a ListView with some text, each row contains different length text and
I have ListView with about 30 items. When I click on an item, some
jQueryMobile: In a simple listview I have the following: <li><a>SOME TEXT</a></li> A data-icon of
I have ListView. Every row has TextView with some text. And also by default
I have a listview with some items. I would like to get the text

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.