Home > Mobile >  Android RadioGroup. SetOnCheckedChangeListener click event is executed only once why
Android RadioGroup. SetOnCheckedChangeListener click event is executed only once why

Time:10-06

Concrete is what I'm doing a test APP after clicking the RadioButton to judge right and wrong, and below the judgment result is shown in TextView controls, when click on the below will be displayed after a judgment as a result, click again on the other box is not carried out, is this why

CodePudding user response:

You just click the same choice, he won't trigger

CodePudding user response:

The
reference 1/f, 113 dancers keyboard response:
you just click the same choice, he would not trigger

I click other RadioButton it won't trigger

CodePudding user response:

Probably other not included in the Group

CodePudding user response:

The
reference 3 floor ink_s response:
probably other not included in the Group

Isn't this meaning, is a triggers the click event click, then click on the trigger, and less of the control, mainly is the event

CodePudding user response:

Will you look at the code

CodePudding user response:

reference 5 floor zhang106209 reply:
to your code to see

String sql1="select id, question, optionA, optionB optionC, optionD, answer, q_type, image from the Text where id='" + id_topic01 +"' ";
Cursor cs=db. RawQuery (sql1, null);
While (cs) moveToNext ())
{

Final int a1=cs. Get int (0);
String a2=cs. Get String (1);
String a3=cs. Get String (2);
String a4=cs. Get String (3);
String a5=cs. Get String (4);
String a6=cs. Get String (5);
Int a7=cs. Get int (6);
Int a8=cs. Get int (7);
//String a9=cs. Get String (8);
Byte []=bs cs. GetBlob (8);


//the integrated=a9;//the getText ();
//System. Out.println (integrated + "... ");
Question_text_exercise_topic. SetText (a2);
RadioA_text_exercise_topic. SetText (a3);
RadioB_text_exercise_topic. SetText (a4);
If (bs!=null) {
Imageview_text_exercise_topic. SetVisibility (0);
Bitmap=BitmapFactory. DecodeByteArray (bs, 0, bs. Length);
Imageview_text_exercise_topic. SetImageBitmap (bitmap);
}
The else {
Imageview_text_exercise_topic. SetVisibility (8);

}

If (a8==0) {
RadioC_text_exercise_topic. SetVisibility (8);
RadioD_text_exercise_topic. SetVisibility (8);
}
The else {
RadioC_text_exercise_topic. SetText (a5);
RadioD_text_exercise_topic. SetText (a6);
}

S3=a3;
S4=a4;
S5=a5;
S6=a6;
S7=a7;

}
RadioGroup_text_exercise_topic. SetOnCheckedChangeListener (new OnCheckedChangeListener () {

@ Override
Public void onCheckedChanged (RadioGroup group, int checkedId) {
//TODO Auto - generated method stub
If (radioA_text_exercise_topic isChecked ()) {
T=1;
}
If (radioB_text_exercise_topic isChecked ()) {
T=2;
}
If (radioC_text_exercise_topic isChecked ()) {
T=3;
}
Else if (radioD_text_exercise_topic isChecked ()) {
T=4.
}
If (t==s7) {
True_text_exercise_topic. SetText (" right ");
False_text_exercise_topic. SetVisibility (8);
}
Else if (t! S7)={
True_text_exercise_topic. SetVisibility (8);
If (s7==1) {
False_text_exercise_topic. SetText (" error, the correct answer is: "+ s3);

}
If (s7==2) {
False_text_exercise_topic. SetText (" error, the correct answer is: "+ s4);

}
If (s7==3) {
False_text_exercise_topic. SetText (" error, the correct answer is: "+ s5);

}
Else if (s7==4) {
False_text_exercise_topic. SetText (" error, the correct answer is: "+ s6);

}}
}});

CodePudding user response:

You interrupt point to look at, I feel more than once, whether the button is not contained in the Group

CodePudding user response:

refer to 7th floor zhang106209 response:
interrupt point to look at you, I feel more than once, whether the button not included in the Group

If not included in the Gruop should also perform not for the first time, but this can perform at a time

CodePudding user response:

1. Did your radiobutton accidentally set the click event, if set please delete
2. You click on all the rb is a trigger for the first time?
3. The first time when triggered, click other rv selected will change?
  • Related