'Adapter Android Studio Button

I have an adapter with a button inside and I don't really know ho to do something when I presse the button. It's an order app and in the the basket I have a delete button to delete a dish. Do you have a solution ?



Solution 1:[1]

Maybe you can find the solution here: https://stackoverflow.com/a/37846430/

Instead of implementing the View.OnClickListener in the ExampleClickViewHolder, you should be fine with simply setting an onClickListener to your button and call the mOnEntryClickListener.onEntryClick in it.

For a more reliable answer, please add some details on your current code.

Solution 2:[2]

So I put the code of the button in the adapter and I put in it ""list.removeAt(position) notifyDataSetChanged()""

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nf3lix
Solution 2 Kai - Kazuya Ito