Check if onCheckedChanged is caused by the user, and not by device rotation

I have the same problem as this unanswered question

my question is:

Is there a way to find out if the onCheckedChanged method is called by user input (in particular, by the user who selects the switch parameter) or if it is called due to device rotation?

Thank,

+2
source share
1 answer

Hallelujah!

It works! :

public void onCheckedChanged(RadioGroup group, int checkedId) {

    if (group.findViewById(checkedId).isPressed()) {
       //This will only execute if pressed. not if device rotates
    }

}
+8
source

All Articles