djtalez / android-binding

Automatically exported from code.google.com/p/android-binding
0 stars 0 forks source link

OnCheckedChange even trigger many times in ListView #16

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In a ListView, I have a checkbox with OnCheckedChange even.

1. Inside the OnCheckedChange Command.
We add/remove one of the item of the source, which trigger the 
CollectionAdapter.onCollectionChanged

2. After that, because the collection.size is changed.  AndroidBinidng will do 
the re-mapping. (CollectionAdapter.getView)

3. This operation will trigger the Attribute.onPropertyChange  and it will 
cause the checkbox OnCheckedChange happen again.

Seems it is a dead lock

May I know whether it is a bug or it is as your expect?

Original issue reported on code.google.com by laozhuan...@gmail.com on 24 Sep 2011 at 9:09

GoogleCodeExporter commented 8 years ago
This is interesting. Normally there's no easy way to distinguish the change is 
coming from user or from code, and whatever changes made on the checkbox will 
fire the onCheckedChange event, and thus the command. I will look at rethink 
about the situation (try adding someway to prevent firing non-user triggered 
changes). 

Original comment by gueei....@gmail.com on 24 Sep 2011 at 3:58

GoogleCodeExporter commented 8 years ago
Found the problem. 
From 0.52, the onCheckedChange will not fire if it is not coming from UI. 

Original comment by gueei....@gmail.com on 24 Jul 2012 at 7:14