3

I have the following tutorials on creating tabs in Android. It is found here and here.

The first one uses FragmentTabHost and the second one uses TabHost in creating the tab with the use of fragments. I have a difficulty in trying to identify its difference and implication on its performance.

I tried to search but failed to find the answer. Can anyone help me here? Thanks.

Jonik
  • 80,077
  • 70
  • 264
  • 372
princepiero
  • 1,287
  • 3
  • 15
  • 28
  • By the way, I know that FragmentTabHost extends TabHost but I want to know other information that might be beneficial, i.e. which is better and what could be the possible performance issues that a developer can see in the future. – princepiero Aug 15 '13 at 10:24

1 Answers1

3

I have a difficulty in trying to identify its difference and implication on its performance.

As it's name suggest a FragmentTabHost is a special case of TabHost specifically built to handle tab fragments. As you can see from the official guide it's quite easy to use the FragmentTabHost with fragments, compare this to the tutorial that you linked to and you'll see the(quite big) difference(which makes it easier to make errors).

There isn't a performance difference other than a performance problem introduced by working with the fragments themselves(which shouldn't happen if they are built right).

It's kind of the same difference between an Activity and a ListActivity, one(the ListActivity) makes it easier to work in a specific scenario(content using a ListView) through some convenience methods(getListView(), getListAdapter() etc).

user
  • 86,916
  • 18
  • 197
  • 190