Radiobutton1
Radiobutton2
Radiobutton3
Radiogroup
Radiobutton4
Radiobutton5
Radiobutton6
The Button
Give radiobutton1 assignment 1
Give radiobutton2 assignment for 2
Give radiobutton3 assignment for 3
Give radiobutton4 assignment is 4
Give radiobutton5 assignment for 5
Give radiobutton6 assignment is 6
And then I click on the button, can be summed up, such as I ordered radiobutton1 and radiobutton5
The sum of the value of 6
CodePudding user response:
Look at the radiogroup specific usagePrivate int btn_num1;
Private int btn_num2;
Radiogroup1. SetOnCheckedChangeListener (new RadioGroup. OnCheckedChangeListener () {
@ Override
Public void onCheckedChanged (RadioGroup group, int checkedId) {
The switch (checkedId) {
Case R.i d.r adiobutton1:
Btn_num1=Integer. ParseInt (" 1 ")
break;
Case R.i d.r adiobutton2:
Btn_num1=Integer. ParseInt (" 2 ")
break;
.
}
}
});
The above radiogroup2
Button click sum not to mention
CodePudding user response: