私は持っています
<RadioGroup
android:id="@+id/sign_up_select_colour"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
<RadioButton
android:id="@+id/rdbtn_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/red" />
<RadioButton
android:id="@+id/rdbtn_blue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/blue" />
</RadioGroup>
ここでEditTextを使用したのと同じ方法で(前にあなたの助けを借りて)、文字列blueを次のアクティビティに送信したいと思います。
EditText editTextSignUpUserName = (EditText) findViewById(R.id.sign_up_user_name);
String signUpUserName = editTextSignUpUserName.getText().toString();
intent.putExtra("username", signUpUserName);
私はこれを試しました。
RadioButton selectedRadioButton = (RadioButton) findViewById(R.id.sign_up_select_colour);
String signUpColour = selectedRadioButton.getCheckedRadioButtonText().toString();
intent.putExtra("colour", signUpColour);
どうぞよろしくお願いします。