Android Studio RadioGroup判断点击按钮

Android Studio RadioGroup判断点击按钮

class RadioListener implements RadioGroup.OnCheckedChangeListener {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {

        RadioButton ra1=(RadioButton)findViewById(group.getCheckedRadioButtonId());
        String str="RadioButton1";
        if  (ra1.getText().toString().equals(str)){
            Toast.makeText(MainActivity.this, str, Toast.LENGTH_LONG).show();
        }
    }

你可能感兴趣的:(Android,Studio)