java.lang.NullPointerException CheckBox.isChecked();

时间:2016-03-06 12:44:56

标签: android

我遇到了NullPointerException错误。

if(Cb_Ar.isChecked())
        toPass = Cb_Ar.toString();
    else if (Cb_Db.isChecked())
        toPass = Cb_Db.toString();
    else if (Cb_Hb.isChecked())
        toPass = Cb_Hb.toString();

这是我的LogCat;

03-06 20:38:54.907 3274-3274/? E/AndroidRuntime:  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.widget.CheckBox.isChecked()' on a null object reference

03-06 20:38:54.907 3274-3274/? E/AndroidRuntime:     at com.example.jello.letscook.showmenu.showList(showmenu.java:73)

03-06 20:38:54.907 3274-3274/? E/AndroidRuntime:     at com.example.jello.letscook.showmenu.onCreate(showmenu.java:46)

03-06 20:38:54.907 3274-3274/? E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:6237)

0 个答案:

没有答案