java - Handle the "no choice" in a radiobutton group -
I have the following problem. I have a radiogram with 3 radio boots. None of them is selected as default. Nearly one button is pressed on the button, my app does something that according to the selection of Radiobutton. If a radio button is selected, my app crashes, I use switch-case Can I override the problem without using a try-holding statement? Thank you.
Note: I tried to apply my argument to the "Default:" section of the switch loop without any success
Edit below is my switch statement. .. Checked changes to public zeros (radio group arg0, int checkedId) {switch (spot_chooser) {case 0: theString10 = "hello"; break; Case 1: theString10 = "Yo"; break; Case 2: theString10 = "trirano"; break; Default: theString10 = "Choose Me"; break; }}
boolean check = false; Button your button; Radiobutan BTN = (radio button) PowerVBIID (RID. Radiabutan); Btn.setOnCheckedChangeListener (New Onk Checked Change Listener) {@Override changed from public to zero changed (compounded button button view, bullion is hacked) {switch (isChecked) {case 0: theString10 = "Hello"; check = , Check; break; case 1: theString10 = "yo"; check = is, check, break; case 2: theString10 = "trees"; check = hatch, break;}}}); YourButton.setOnClickListener (New OnClickListener) {@Override public void onClick (see v) {// TODO auto generated method stub if (check == incorrect) {Toast. Make text ("Please check radioabutan", " Toast LENGTH_LONG) .show (); /// Toast, please check here for Radiotechnology} and {////// do your work Toast. Make Text (this, theString10, toast.LENGTH_LONG) .show ();} }});
Comments
Post a Comment