[Solved] Nullpointer on sql query with android [duplicate]


The first code snippet you have provided is not sufficient to answer the question with any degree of certainty. From the exception it would appear that the sqlHandler variable is null, but you have not provided any code to show how you are instantiating this.

sqlHandler seems to be a global variable, so you’ll want to set it to an instance of the SqlHandler class before you use it, eg in the constructor of the class that uses it or just before calling one of its methods.

sqlHandler = new SqlHandler(*some var of type Context*);

solved Nullpointer on sql query with android [duplicate]