RadioButton rb = (RadioButton) findViewById(R.id.sex1); if (rb.isChecked()) { sex = "M"; } else { sex = "F"; }