Skip to content Skip to sidebar Skip to footer

Nullpointerexception Android

I am getting NullPointerException and I couldn't fix it. Could anyone please have a look at my code to see what the problem is and how to fix it. Thanks in advance. DatabeseDEO.cla

Solution 1:

First of all as naming convention rename the DbHelper to dbHelper

Answer : you have to constructors

publicDatabaseDEO(Context context) {
        DbHelper = new DatabaseHelper(context);
    }

    publicDatabaseDEO() {

    }

first one you initialize the databaseHelper and the second one you don't initialize it.

In AddWallet you call the empty Constructor so the DatabaseHelper is not initialized you have to call the second constructor and delete the empty one to not wrongly call it again.

Post a Comment for "Nullpointerexception Android"