full code
how do i access the parent activity's mail layout elements? In this case a button. I have it declared in main.xml. When a button in the listview is clicked, i want to change the text of the button in main.
views:
27answers:
1
A:
So you have a ListView and a button in your layout, and you want to change the button's text, when one of the buttons in your ListView is clicked? There're many ways to achieve this.
You could pass the reference of your button to your custom Adapter class. That way you can accesss that button from the inner event handler calss you defined for the buttons in your list rows - so you can change its text.
You could fire a broadcast intent from the row-buttons' event handlers. You listen for these intents in your Activity, and change the Button's text accordingly. This may be an overkill tho.
Use a static method for it in the Activity.
etc.
Scythe
2010-10-20 09:49:48