Reputation: 85
My custom Listview has more than one button, how can I identify which button has been clicked ? I want to do different things on action of different buttons.
Upvotes: 1
Views: 340
Reputation: 6691
Create local variables for buttons inside getview method and set onClickListener for each button in a row.
Also have a look at this -: 2 Buttons in ListView in android
Upvotes: 1
Reputation: 2681
In custom adapder of your ListView
you must be creating objects of each button in its getView()
method.
Just set the onClickListener
on the buttons and perform the action on each buttons in its onClick()
.
Upvotes: 2