How to reference child activity from TabHost to call a public function?

前端 未结 6 566
别那么骄傲
别那么骄傲 2020-12-24 03:21

I have a TabHost with two child activities in it (in two tabs). I also implemented a public function in one of these activities that i would like to call from my parent (Tab

6条回答
  •  生来不讨喜
    2020-12-24 03:51

    Thank you, this helped me to solve a simular problem!

    Activity currentActivity = getLocalActivityManager().getActivity(_TabHost.getCurrentTabTag());
    if(currentActivity != null && currentActivity instanceof iMyActivity)
    {
    // pass to children
    ((iMyActivity)currentActivity).onLaunchDelegate();
    }
    

提交回复
热议问题