8

Quick question, Whats the difference between actionbar and tabhost. I used to use tabhost and add tabs to it.

Then I was asked to use actionbar and reading about it, it seems it is just another way of having tabs. So when would use each? Whats the difference

Thank you

Snake
  • 14,228
  • 27
  • 117
  • 250

1 Answers1

12

Pretty simple: ActionBar is the replacement of TabHost since Android 3.0.

Moreover, ActionBar can do more things than TabHost (like logo as a button, spinners, actions buttons…).

Have a look to ActionBar documentation on Android design guidelines.

Kyriog
  • 828
  • 1
  • 8
  • 13
  • 2
    Another important thing is that ActionBar is based around the concepts of Fragments as opposed to Activities. – user210504 Oct 07 '12 at 20:07
  • 1
    @user210504: Not necessarily. Your tabs in the action bar *can* be tied to fragments, but they do not have to be. You can do whatever you want in your UI to affect a change based on a tab selection. – CommonsWare Oct 07 '12 at 20:16
  • 1
    @CommonsWare I was trying to refer to your earlier comment in a pure holistic way : " If you think this will open up theNewActivity inside the tab, no, that will not work. You can certainly call startActivity() based upon a tab being clicked, but the UX probably is not what you want and even less likely to be what users want. " – user210504 Oct 08 '12 at 02:54
  • 1
    I'd like to know where's the source that said "ActionBar is the replacement of TabHost since Android 3.0". Thank you :) – Zyoo Feb 15 '13 at 11:05
  • 1
    @yolapop Well, if we take TabHost by itself, it's not deprecated. But in this case, I assume that TabHost is a [TabActivity](https://developer.android.com/reference/android/app/TabActivity.html) which is deprecated now. Google recommends to use Fragments instead, so it makes more sense to use ActionBar instead of TabHost. – Kyriog Feb 15 '13 at 15:07