0

I am trying to capture the click on my listview, which contains a checkedtextview my code is as follows

listview.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) 
        { 
            CheckedTextView Item_Check = (CheckedTextView) view;
            if (Item_Check.isChecked())
            {
//code to handle the when item is turned off 
//i.e. previous state was checked and presently its being unchecked
            }
            else 
            {
            }

This works well in ICS, however in Jellybean I am experiencing the straight opposite, i.e. when the button is turned on my turn off code is being executed and the other way around.

Is there any change in Jellybean that is causing this, I mean by way of when the setOnItemClickListener is being called or is it a wrong approach that I am taking.

bsempe
  • 68
  • 4
skv
  • 1,793
  • 3
  • 19
  • 27

1 Answers1

1

This is actually a known Android bug as can be seen here: https://code.google.com/p/android/issues/detail?id=35885

I just stumbled upon this same problem and I am currently trying to find a good and simple workaround for it. As soon as I have something, I'll post it.

bsempe
  • 68
  • 4
  • Thank you very much for this. I have used the following work-around. – skv Mar 21 '13 at 00:16
  • As soon as there is a click, regardless of the state I am saving the data off to application, and removing this as a selected item on the second click (toggle), then on screen scroll I am setting the checked based on the app value, hope it helps you – skv Mar 21 '13 at 09:32