//第一种 button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //获取单选框id int id = radioGroup.getCheckedRadioButtonId(); if (id==R.id.radio1) { sex = "男"; } else if(id==R.id.radio2){ sex = "女"; }else { sex = "未知"; } Toast.makeText(MainActivity.this, "您选择的性别是:"+sex, Toast.LENGTH_SHORT).show(); } }); } private void initView() { button = (Button) findViewById(R.id.btn); radioGroup = (RadioGroup) findViewById(R.id.group); } > 第二种 button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //用数组的按钮获取单选按钮的值 radioButton = (RadioButton) findViewById(radioGroup.getCheckedRadioButtonId()); Toast.makeText(MainActivity.this,"您获取的值是:"+radioButton.getText(), Toast.LENGTH_SHORT).show(); } }); }