Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action Bar Tabs without using Fragments?

It is maybe quite a newbie question but anyway. Since Tabhost is depreciated I tried to switch to the action bar tabs but I have my problems using fragments. Is there a possibility to use activities within the action bar tabs anyway?

I would appreciate any help.

Thanks.

like image 823
Maddin Avatar asked Jun 14 '12 12:06

Maddin


2 Answers

If you're set on using Activities over Fragments you could just use an intent to launch your activity from your ActionBar.TabListener

startActivity(new Intent(thisActivity(), thatActivity.class)); 

You should also check out this comment about using Fragments over Activities

like image 149
MrEngineer13 Avatar answered Nov 18 '22 18:11

MrEngineer13


Is there a possibility to use activities within the action bar tabs anyway?

Fortunately, no.

That does not mean you have to use fragments, though. Your TabListener can do whatever it wants to affect the change in your UI. A brute-force solution would be to call setContentView() again, to dump all your old widgets and lay down a brand-new (presumably different) set.

like image 38
CommonsWare Avatar answered Nov 18 '22 17:11

CommonsWare