Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: get activity from tab or intent?

my app uses a tab bar, each tab button associates an Activity, so when you click on a tab button, it shows the screen for that activity, now it need to detect user click on current/active tab button, I've already finished the code to detect that, but now I need to inform the corresponding activity of the click, is there any way to get the activity associated with tab button? Or can I get the activity started by an intent, if I have the reference to the intent?

Thanks!

like image 410
hzxu Avatar asked Apr 24 '26 16:04

hzxu


1 Answers

It's a little late for your answer but you can try :

String tabTag = getTabHost().getCurrentTabTag(); 
Activity activity = getLocalActivityManager().getActivity(tabTag); 
like image 146
Dany Y Avatar answered Apr 26 '26 06:04

Dany Y



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!