rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { int childCount = group.getChildCount(); for (int x = 0; x < childCount; x++) { RadioButton btn = (RadioButton) group.getChildAt(x); if (btn.getId() == checkedId) { Log.e("selected RadioButton->",btn.getText().toString()); } } } });
radiogroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { void onCheckedChanged(RadioGroup rg, int checkedId) { for(int i=0; i<rg.getChildCount(); i++) { RadioButton btn = (RadioButton) rg.getChildAt(i); if(btn.getId() == checkedId) { String text = btn.getText(); // do something with text return; } } } });
HashMap<Integer,Boolean> map = new HashMap<Integer, Boolean>(); Toast.makeText(context, text1, Toast.LENGTH_SHORT).show(); for (int i = 0; i < rgroup.getChildCount(); i++) { RadioButton btn = (RadioButton) rgroup.getChildAt(i); if (btn.getId() == checkedId) { String text = btn.getText().toString(); map.put(btn.getId(),true); String text1 = user_answer.put(i+"", text); Toast.makeText(context, text1, Toast.LENGTH_SHORT).show(); } }
int childCount=group.getChildCount(); for (int i=0;i<childCount;i++){ if(group.getChildAt(i) instanceof RadioButton ) { // check if child is `RadioButton` RadioButton r_btn = (RadioButton) group.getChildAt(i); if (r_btn.getId() == checkedId) { System.out.println(r_btn.getText().toString()); } } }
radiogroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { void onCheckedChanged(RadioGroup rg, int checkedId) { for(int i=0; i<rg.getChildCount(); i++) { RadioButton btn = (RadioButton) rg.getChildAt(i); if(btn.getId() == checkedId) { String text = btn.getText(); // do something with text return; } } } });
rg.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub int childCount = group.getChildCount(); for (int x = 0; x < childCount; x++) { RadioButton btn = (RadioButton) group.getChildAt(x); if (btn.getId() == checkedId) { System.out.println(btn.getText().toString()); } } });
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { void onCheckedChanged(RadioGroup rg, int checkedId) { for(int i=0; i<rg.getChildCount(); i++) { RadioButton btn = (RadioButton) rg.getChildAt(i); if(btn.getId() == checkedId) { String text = btn.getText(); // do something with text return; } } } });
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup rg, int checkedId) { for(int i=0; i<rg.getChildCount(); i++) { RadioButton btn = (RadioButton) rg.getChildAt(i); if(btn.getId() == checkedId) { String text = btn.getText().toString(); // do something with text Toast.makeText(demo.this,text,Toast.LENGTH_SHORT).show(); return; } } } });
int count = radioGroup.getChildCount(); for (int i = 0 ; i < count; i++) { RadioButton button = (RadioButton) radioGroup.getChildAt(i); if (button.getText().equals("choice2")) { int id = button.getId(); // the ID you're looking for } }
radiogroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { void onCheckedChanged(RadioGroup rg, int checkedId) { for(int i=0; i<rg.getChildCount(); i++) { RadioButton btn = (RadioButton) rg.getChildAt(i); if(btn.getId() == checkedId) { String text = btn.getText(); // do something with text return; } } } });
for(int i=0; i<radioGroup.getChildCount(); i++) { RadioButton btn = (RadioButton) radioGroup.getChildAt(i); if(btn.getId() == checkedId) { String text = btn.getText();
for (int i = 0; i < particularRadioGroup.getChildCount(); i++) { RadioButton childAt = (RadioButton) particularRadioGroup.getChildAt(i); boolean checked = childAt.isChecked(); int id = childAt.getId(); String text = childAt.getText().toString(); // Save the Data of the RadioButton of the Particluar RadioGroup // Save Here }
System.out.println(t); if(btn.getId() == checkedId) { String text = btn.getText().toString();