2014-09-28 128 views
-1

它不显示任何错误,但是当我在手机上运行它时,应用程序每次都会崩溃!无法查看单选按钮的值

`PizzaType.java

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); 
    String data = getIntent().getExtras().getString("Bbread"); 
} 

Overview.java

protected void onCreate(Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_overview); 
    String value= getIntent().getStringExtra("Bbread"); 
    Intent intent = new Intent(this, Pizzatype.class); 
    intent.putExtra("Bbread", value); 
    startActivity(intent); 
    String data= getIntent().getStringExtra("Bbread"); 
} 
+0

你想实现什么,异常的堆栈跟踪是什么? – lc2817 2014-09-28 23:57:25

+0

我的应用程序就像你可以订购比萨饼,所以你选择你的面包类型比你的浇头,所以他们involoe单选按钮和复选框,最后我必须显示什么用户选择订单的概述像收到什么你有 – 2014-09-29 00:01:56

+0

和堆栈跟踪? – lc2817 2014-09-29 00:05:44

回答

0

尝试清洗和重新运行项目。 R.java文件有时会被破坏。并导致空指针异常。