0

I just made a very simple listener for checkboxes in a list view but the only problem is when I select any of these items no Toast popping up.

listView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            Toast.makeText(getApplicationContext(), "Click works!", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

What's wrong with this?

Emre Aydin
  • 569
  • 2
  • 16

1 Answers1

0

Add these two lines to your checkbox

 android:focusable="false" 
 android:focusableInTouchMode="false"

here and here are the good explanation of the scenario if you want to learn the issue in details

nvinayshetty
  • 3,187
  • 1
  • 21
  • 32
  • I had setItemsCanFocus to false but haven't done it for inTouchMode thing. I will share the results once done. – Emre Aydin May 02 '15 at 18:15