What is the right way to communicate from a custom View to the Activity in which it resides?
- 阅读更多 关于 What is the right way to communicate from a custom View to the Activity in which it resides?
问题 I have a custom View class that extends Spinner. I'm trying to figure out what the correct way to talk to the Activity that it's embedded in is, when the user makes a selection. I see that the OnItemSelected listener gets a reference to the Adapter, but I'm not clear on whether or not I should be using this adapter and walking up its parent chain somehow, or if I should just talk directly to the context (for some reason that doesn't feel safe, even though I can't think of a way in which it