Skip to content Skip to sidebar Skip to footer

Android : Passing Button Click Response From Getview() Method Of Adapter Class To Mainactivity

The question is simple. I have written a seperate class which extends ArrayAdapter. This adapter deals with couple of TEXTVIEWs and a BUTTON. The problem is I am not sure whether I

Solution 1:

How about having a reference to the activity in your arrayadapter's constructor? Something like

publicYourArrayAdapter(YourActivity a){
     mActivity = a;
}

And referring mActivity from the onClickMethod?

In your YourActivity you can have an onItemButtonClicked() method to be called from there.

Post a Comment for "Android : Passing Button Click Response From Getview() Method Of Adapter Class To Mainactivity"