I have a custom ListView in which there are 2 buttons and a textview in each row.
I want to change the text of the clicked button. How to identify that which button of which row has been clicked and then how to change the text of the same button.
I have a custom ListView in which there are 2 buttons and a textview in each row.
I want to change the text of the clicked button. How to identify that which button of which row has been clicked and then how to change the text of the same button.
How to identify that which button of which row has been clicked
Use onClickListener(). When a button is clicked that button's onClickListener will be called.
How to change the text of the same button
In onClickListener() you can do something like
yourTextView.setTextColor(Color.rgb(0,0,0)); //replace 0,0,0 with the rgb value of the color
there are lots of example for the having Different Clickable Views in one single ListView
like this
point should keep
You need set the listener to each view in getView (don't create in each time in get view just pass already created one or can pass this and implement the listener in same adapter class)
You 'll also required the row position
so can use different logic like get & Set tag
or get button view parent (which will be list row)
as in this link