Search code examples
androidtabactivity

Android same tab bar for all activities


well, I have my Android app that have 4 main options. For that I created a TabActivity with this options.

Problem, when I enter to one of this, a activity is called. Cool. Imagine I have a list and when I click on one row I open other activity, the tab will disappear what is correct. But I want this tabBar always.

how can I achieve this? if I copy/page this tab in every activity I need it it will load the ones that are attached to the tab and wont show the one that I opened before, right?


Solution

  • You should try with FragmentActivity. There is a addTab function to add tabs to action bar, in which you set tabs. With fragments and action bar what you want to do is possible

    Take a look at Action Bar Sherlock that includes actionbar compatibiliy with tabs and more for non Honeycomb versions of Android.