Null Pointer Exception when using delete
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
dDbHelper.deletedJournal(info.id);
mDbHelper.deleteJournal(info.id);
public bo开发者_StackOverflowolean deletedJournal(long homeId){
return mDb.delete(DATABASE_TABLE, KEY_HOMEID + "=" + homeId, null )>0;
}
dDbHelper.deletedJournal(info.id)
gives me a null pointer exception
I'm betting that info is null. This might be helpful:
Why is MenuItem.AdapterContextMenuInfo null when my list view has a custom adapter?
Either dDbHelper
or info
is null
.
精彩评论