Program rules execution and effects in Android

Hi,
I’m using the Android Skeleton app. I’ve added some functionalities regarding program rules in the app. When I click a checkbox in an event form I got some extra checkboxes clicked automatically. I don’t know this happened. My forked codes are in https://github.com/RahmanMonjur/dhis2-android-skeleton-app/tree/ereg_matlab

Monjur

1 Like

Hi @RahmanMonjur !
This is happening because of how the view holders are recycled. Once the onCheckedChangedListener is ready, every time the bind method is called it was performing a check action which activated the listener with the wrong values to be saved.
So the best way to handle this is removing the listener if it exist before updating the values.

Hope this helps :slight_smile:

3 Likes

It worked like a charm. Thanks @Pablo. Appreciating this.

1 Like