@Override
protected void onCreate(Bundle savedInstanceState) {
String value = ((radio1) findViewById).getText().toString();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pizzatype);
Intent intent = new Intent(Pizzatype.this, Overview.class);
intent.putextra("Bbread","Brown Bread");
startActivity(intent);
}
答案 0 :(得分:0)
您的问题是您没有说出radiobutton的ID是什么
试试这个:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pizzatype);
RadioButton rButton = (RadioButton) findViewbyId(R.id.radiobutton)
String rText = rButton.getText().toString()
Intent intent = new Intent(Pizzatype.this, Overview.class);
intent.putextra("Bbread","Brown Bread ");
startActivity(intent);
}
并将RadioButton定义如下:
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/radiobutton"
android:text="option1"/>