I have this method in a class (non-activity) -
public boolean usernameChk(String usrname) {
String usrnmQuery = \"SELECT * FROM \" + TABLE_ACCOUNTS + \"
You have not passed proper context of your activity that is why its throwing nullpointer error.
Just change your method as below.
public boolean usernameChk(String usrname){
String usrnmQuery = "SELECT * FROM " + TABLE_ACCOUNTS + " WHERE username = '" + usrname + "'";
SQLiteDatabase db = this.getReadableDatabase();
Declare one common Context in your DatabaseHelper and assign the value of constructor in your while creating instance of your helper class as below:
public Context m_context;
public DatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
m_context = context;
}