android-radiogroup

Android: RadioGroup - How to configure the event listener

为君一笑 提交于 2019-11-26 07:36:46
问题 From my understanding, to determine if a checkbox is \"clicked\" and find if it\'s checked or not, code such as the following can be used: cb=(CheckBox)findViewById(R.id.chkBox1); cb.setOnCheckedChangeListener(this); public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { cb.setText(\"This checkbox is: checked\"); } else { cb.setText(\"This checkbox is: unchecked\"); } } However, I am unable to work out the logic on how to do the above for a radiogroup.