@Override public boolean onItemLongClick(AdapterView<?> av, View v, int position, long id) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setTitle("Delete..."); alertDialog.setMessage("Are you sure you want to delete this note?"); alertDialog.setCancelable(false); final int p = position; alertDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { helper.delete(p); } }); alertDialog.setNegativeButton("No", null); alertDialog.show(); return true; }
public void delete(int id) { getWritableDatabase().delete("notes", "_ID="+Integer.toString(id), null); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)