Check if onCheckedChanged called by user input and

2020-07-24 05:43发布

I am having the same issue as this unanswered question

my question is:

Is there a way to find out if the onCheckedChanged method is called by user input (specifically the user selecting a radio button option) or if it is being called due to device rotation?

Thanks,

标签: java android
1条回答
够拽才男人
2楼-- · 2020-07-24 06:00

hallelujah!

This Works!:

public void onCheckedChanged(RadioGroup group, int checkedId) {

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

}
查看更多
登录 后发表回答