I know this question has been asked alot, but many of the answers I have found have been unsatisfactory.
I have a Baseadapter which displays a list via a database. The information is passed from the database to the list via a cursor, which adds the cursor to an arraylist, which then populates the listview. I would like to delete a listitem via a contextmenu and have it deleted from both the listview AND the database. Currently, I am using adaptercontextmenuinfo object to get the position and/or id which I pass to a delete method in the database class, but the info.id is not corresponding with the database _id. Currently I am able to successfully remove the row entry from the listadapter, but NOT from the database. Any help would be much appreciated. (note: my database has 3 columns, the first of which being _id) ContextMenu java:
@Override
    public boolean onContextItemSelected(MenuItem item) {
        if(item.getTitle() == "Delete"){ //if "delete" is selected
            AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
            dba.deleteRow(info.id);
            DATA.remove(info.position);
            adapter.notifyDataSetChanged();
Database delete row method:
public void deleteRow(long rowId){
        db = dbhelper.getWritableDatabase();
        try{
            db.delete(Constants.TABLE_NAME, Constants.KEY_ID + "="+rowId,null);
        }catch(Exception e){
        }
    }
I know there is alot of code involved here. If you want more, let me know. Thanks for your help!
 
    