Question

I am using .setOnCheckedChangeListener to check a change on Radio group with three buttons. as per name it will detect if a change in radio buttons is detected. Hence clicking on the already selected item wont invoke anything.

is there any alternative that will work even for the selected radio , ignoring that it is already selected

Was it helpful?

Solution

You question is a bit confusing. But as far as I understood, onCheckedChanged fires automatically when your activity is loaded first time provided that you have set listener in onCreate method.

You can implement on onClick but then you have to take care of both events. As onClick will fire first and then onCheckedChange will fire. And in OnCheckedChange you can detect whether the Radio button changed or not by using a temporary variable.

Hope this answers your question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top