2

How can I get a specific Activity from TabActivity or TabHost?

I tried TabHost.getChildAt(), but a View instance can't be casted to an Activity instance.

Or how do you get an Activity which is running in background?

MByD
  • 135,866
  • 28
  • 264
  • 277
draw
  • 4,696
  • 6
  • 31
  • 37
  • http://stackoverflow.com/a/22131769/2624806 http://stackoverflow.com/a/5399466/2624806 could help you here. – CoDe Mar 02 '14 at 18:48

3 Answers3

7

I couldn't find TabActivity.getLocalActivityManager().getActivity().

For me it worked using TabActivity.getLocalActivityManager().getCurrentActivity().

Christian Specht
  • 35,843
  • 15
  • 128
  • 182
dgimenes
  • 892
  • 11
  • 23
2

found the answer: just use TabActivity.getLocalActivityManager().getActivity()

draw
  • 4,696
  • 6
  • 31
  • 37
1

I know this isn't what you're looking for, but I HIGHLY recommend not using TabActivity. In all the projects I've worked on, we wound up yanking it out and just using buttons that look like tabs.

I also think its deprecated in 3.0, and certainly Ice cream. They push the action bar. I'd look for one of the available action bar libraries.

Kevin Galligan
  • 16,159
  • 5
  • 42
  • 62
  • 2
    What was so bad about it that you stopped using it? How did you end up handling activity groups? – dvs Nov 03 '11 at 00:13