I want to select just one radio button at a time, but after selecting one of them when I click on the other button they both are selected, what can I do to solve this problem.
My MainActivity.java code is
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onClick(View view) {
TextView text=(TextView)findViewById(R.id.txt1);
text.setText("Wrong Answer");
}
public void onClick1(View view) {
TextView text=(TextView)findViewById(R.id.txt1);
text.setText("You are Right");
}
}
RadioButton should be the direct child of RadioGroup, Otherwise grouping does not work.
And in java file
do something