0

I'm using TabActivity to implement tabs in my project and I want to communicate with activities of tabs and invoke some methods from tabActivity and I use method below:

CoachActivity activity=(CoachActivity) getLocalActivityManager().getActivity(mTabHost.getCurrentTabTag());

but activity is null. CoachActivity is Tab1 activity.

My code is a bit long so I don't post it here. I double checked everything and I'm sure the problem isn't about the setup of my tabs. I set the current tab and I checked that CoachActivity is created.

Mohamad Ghafourian
  • 1,052
  • 1
  • 14
  • 26
  • 1
    `LocalActivityManager` has been deprecated for about two years. `TabActivity` has been deprecated for a similar length of time. Please consider switching to a modern implementation of tabs: `FragmentTabHost`, action bar tabs, `ViewPager` and a tab-style indicator, etc. Or, go with plain `Views` as the tabs in an activity directly holding a `TabHost` and `TabWidget`. – CommonsWare Jul 21 '13 at 21:53
  • Tnx a lot for your your comment. I'm using API level 10 so I can not use fragments (I suppose). If it's possible help me with other ways possible. I searched about it and could't find anything not using both TabActivity and FragmentTabHost. post tutorials links. Thank you very mush @CommonsWare – Mohamad Ghafourian Jul 21 '13 at 22:52
  • "I'm using API level 10 so I can not use fragments (I suppose)" -- the Android Support package has had a backport of fragments for about two years. – CommonsWare Jul 21 '13 at 23:19
  • @CommonsWare hey man I did what you've said to me. I implement my tabs with viewPager but I have the same problem again. I posted my code here:http://stackoverflow.com/questions/17792076/implementing-tabs-with-simple-views-and-fragments/ (ignore first paragraph :) ) please help me Thanks – Mohamad Ghafourian Jul 22 '13 at 22:23

0 Answers0