In RecyclerView there is a button, when I click on it, the current record, which I store in sqlite, should be deleted. Created a method that will delete the record itself:
public void deleteFruit(Fruit fruit) { SQLiteDatabase db = this.getWritableDatabase(); db.delete(TABLE_CONTACT_FRUIT, KEY_ID_FRUIT + " = ?", new String[]{String.valueOf(fruit.getId())}); db.close(); } But I don’t know how to transfer the parameter of the item that I want to delete.
And where is it better to call this method: in the main activation or in the adapter?
Adapter code: