Skip to content Skip to sidebar Skip to footer

Android Null Pointer Exception

Im getting a 'NullPointerException' when I try and load my intent to a class that handles my listview of the data from my database. I'm a total newbie when it comes to listviews so

Solution 1:

You simply forgot to call open().

HotOrNotContent=newHotOrNot(this, null, null);
Content.open();
Cursorcursor= Content.getData();

(But please read about Java naming conventions, which state variables should start with a lowercase letter.)

Solution 2:

publicHotOrNot(Context c, SQLiteDatabase newSQL, DBHelper BD){
    ourContext = c;
    ourDatabase = newSQL;
    ourHelper = BD;

}

Here, you're passing null in the onCreate to the SQLiteDatabase

HotOrNotH=newHotOrNot(this, null, null);

Post a Comment for "Android Null Pointer Exception"