Search Results

Search found 1 results on 1 pages for 'user3461659'.

Page 1/1 | 1 

  • How to get radio button's id and convert to string?

    - by user3461659
    I am working in Android Studio and am trying to get the ID of the selected radio button and then store the ID in a string. Is this possible? I have tried replacing the .getText() method below with .getId() but it wont let me store it as a string: RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int checkedId) { RadioButton checkedRadioButton = (RadioButton) findViewById(checkedId); String text = checkedRadioButton.getText().toString(); Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show(); } });

    Read the article

1