开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜