NullPointerException on getReadableDatabase()

前端 未结 5 1122
自闭症患者
自闭症患者 2021-01-17 04:49

I have this method in a class (non-activity) -

public boolean usernameChk(String usrname) {

    String usrnmQuery = \"SELECT * FROM \" + TABLE_ACCOUNTS + \"         


        
5条回答
  •  甜味超标
    2021-01-17 04:56

    The Context you pass to your DatabaseHandler constructor is null.

    That's the explanation for the NPE in getDatabaseLocked(). To get help fixing that, post code where you initialize the context.

提交回复
热议问题