How to create tabs in android?

   <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="bottom" >

        <TabHost
            android:id="@+id/tabHost"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom" />

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_gravity="bottom|center_horizontal" >

                <LinearLayout
                    android:id="@+id/tab1"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:paddingTop="60px" >

                    <TextView
                        android:id="@+id/txt1"
                        android:layout_width="fill_parent"
                        android:layout_height="100px"/>
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/tab2"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical"
                    android:paddingTop="60px" >

                    <TextView
                        android:id="@+id/txt2"
                        android:layout_width="fill_parent"
                        android:layout_height="100px"
                        android:text="This is tab 2" />
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/tab3"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical"
                    android:paddingTop="60px" >

                    <TextView
                        android:id="@+id/txt3"
                        android:layout_width="fill_parent"
                        android:layout_height="100px"
                        android:text="This is tab 3" />
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/tab4"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:paddingTop="60px" >

                    <TextView
                        android:id="@+id/txt4"
                        android:layout_width="fill_parent"
                        android:layout_height="100px"
                        android:text="This is tab4" />
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/tab5"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical"
                    android:paddingTop="60px" >

                    <TextView
                        android:id="@+id/txt5"
                        android:layout_width="fill_parent"
                        android:layout_height="100px"
                        android:text="This is tab 5" />
                </LinearLayout>
            </FrameLayout>
        </TabHost>
    </RelativeLayout>
in java class

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
        //tabHost.setup();
        tabHost.setup();

        TabSpec spec1 = tabHost.newTabSpec("Tab 1");
        spec1.setContent(R.id.tab1);
        spec1.setIndicator("Tab 1");

        TabSpec spec2 = tabHost.newTabSpec("Tab 2");
        spec2.setIndicator("Tab 2");
        spec2.setContent(R.id.tab2);

        TabSpec spec3 = tabHost.newTabSpec("Tab 3");
        spec3.setIndicator("Tab 3");
        spec3.setContent(R.id.tab3);

        tabHost.addTab(spec1);
        tabHost.addTab(spec2);
        tabHost.addTab(spec3);

    }