What is the right way to communicate from a custom View to the Activity in which it resides?

后端 未结 4 1440
眼角桃花
眼角桃花 2020-12-09 18:09

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 sel

4条回答
  •  既然无缘
    2020-12-09 18:37

    A simple solution -

    ((ParentClass) context).functionToRun();
    

    Where ParentClass is the class name of the activity.

提交回复
热议问题