How to set button on listview based on some conditions
I have a ListView with some text, each row contains different length text and I am using CustomAdapter. I want to add a next button to row which is having long text. When I click on that button it should go to another activity and it should show the full te开发者_Python百科xt of the particular row. I am doing like if the text is long I am making the button Visible on that particular row. My problem how to identify the button on particular row and how to set listener for that button. When I click on a particular button, how to get the particular rows data or position.
setOnClickListener
over Button in getView()
in your CustomAdapter
and from there you will get a call for a particular row button........
in getView() itself you have to set the listener of Button and from getView()'s position variable you can get the index...
if(text.length>10)
//button show
//listener
//next activity
精彩评论