i try to delete a row from my db. I'm using this method:
public void deletePlayerbyID(int id){mDb.delete(SQLITE_TABLE, KEY_ROWID +"="+id, null); }
called in activity :
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView av, View v, int pos, long id) {
return onLongListItemClick(v,pos,id);
}
protected boolean onLongListItemClick(View v, final int pos, long id) {
AlertDialog.Builder builder = new AlertDialog.Builder(AndroidListViewCursorAdaptorActivity.this);
builder.setMessage("Are you sure to delete?").setCancelable(false).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {bdHelper.open();
dbHelper.deletePlayerbyID(pos);
Log.i("ListView", "onLongListItemClick id=" + pos);
displayListView();
}
})
...........
why i can't delete the selected row from listView? i have a method that delete all db and it work.
.
stackoverflow.comm
No comments:
Post a Comment