You could also use TabActivity instead of Activity, and then you
wouldn't need to use a layout xml file.

On Aug 18, 11:47 am, "[email protected]" <[email protected]> wrote:
> This example on tutorials at developer.android.com (and do not works)
> public void onCreate(Bundle savedInstanceState) {
>     super.onCreate(savedInstanceState);
>     setContentView(R.layout.main);
>
>     mTabHost = getTabHost();
>
>     mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("TAB
> 1").setContent(R.id.textview1));
>     mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("TAB
> 2").setContent(R.id.textview2));
>     mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("TAB
> 3").setContent(R.id.textview3));
>
>     mTabHost.setCurrentTab(0);
>
> }
>
> This code example i found in android-sdk (works fine)
>
> protected void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         TabHost tabHost = getTabHost();
>
>         LayoutInflater.from(this).inflate(R.layout.tabs1,
> tabHost.getTabContentView(), true);
>
>         tabHost.addTab(tabHost.newTabSpec("tab1")
>                 .setIndicator("tab1")
>                 .setContent(R.id.view1));
>         tabHost.addTab(tabHost.newTabSpec("tab3")
>                 .setIndicator("tab2")
>                 .setContent(R.id.view2));
>         tabHost.addTab(tabHost.newTabSpec("tab3")
>                 .setIndicator("tab3")
>                 .setContent(R.id.view3));
>     }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to