Android : Android Database returns null

on Friday, October 24, 2014



public class DBHelper extends SQLiteOpenHelper {

SQLiteDatabase dbEvents;


public DBHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE IF NOT EXISTS sampleTable(sampleID INTEGER PRIMARY KEY AUTOINCREMENT,sampleTitle TEXT,sampleDATE BIGINT,trash INTEGER DEFAULT 0) ");
this.dbEvents=db;

}

public Integer deleteItem(Integer itemId){
Log.d("CURSOR:","IM HERE"+eventId);
if(dbEvents == null){
Log.d("CURSOR:","IM NOT INTIALIZING");
}

return null;
}


Where I'm getting IM NOT INTIALIZING


I cannot perform DB operation where it throws to Null Pointer Exception.


thanks in advance


0 comments:

Post a Comment