java.lang.NullPointerException: Attempt to invoke virtual method on a null object reference to select sqlite

前端 未结 3 1145
我在风中等你
我在风中等你 2021-01-01 02:02

I am a newbie of android world. I have a problem of the coding. It was just a tiny error buy i dont know it doesnt work even i change others method but the error still the s

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-01 02:31

    Initialize the DatabaseHelper:

    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.surveyinstruction);
    
        DatabaseHelper db = new DatabaseHelper(this);
    
        //...
    }
    

提交回复
热议问题