Najlepszy sposób na wdrożenie kart w systemie Android?

Przeczytałem przejrzałem kod, który implementuje karty na dole strony aplikacji. W kodzie nie ma przestarzałej metody / klasy, a dla mnie jest to bardzo łatwy i czysty sposób implementowania kart.

Ale słyszałem, że nowym sposobem implementacji kart jest użycie fragmentów.

Więc który jest lepszy? I dlaczego?

XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TabHost
        android:id="@+id/edit_item_tab_host"
        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:paddingTop="65px" >

            <LinearLayout
                android:id="@+id/edit_item_date_tab"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:padding="5px" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="date"
                    android:textStyle="bold" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/edit_item_geocontext_tab"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:padding="5px" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="lieu"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/edit_item_text_tab"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:padding="5px" >
            </LinearLayout>
        </FrameLayout>
    </TabHost>

</LinearLayout>

MainActivity klasa:

import android.app.Activity;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);



        TabHost tab_host = (TabHost) findViewById(R.id.edit_item_tab_host);
        // don't forget this setup before adding tabs from a tabhost using a xml view or you'll get an nullpointer exception
        tab_host.setup(); 

        TabSpec ts1 = tab_host.newTabSpec("TAB_DATE");
        ts1.setIndicator("tab1");
        ts1.setContent(R.id.edit_item_date_tab);
        tab_host.addTab(ts1);

        TabSpec ts2 = tab_host.newTabSpec("TAB_GEO");
        ts2.setIndicator("tab2");
        ts2.setContent(R.id.edit_item_geocontext_tab);
        tab_host.addTab(ts2);

        TabSpec ts3 = tab_host.newTabSpec("TAB_TEXT");
        ts3.setIndicator("tab3");
        ts3.setContent(R.id.edit_item_text_tab);
        tab_host.addTab(ts3);

        tab_host.setCurrentTab(0);




        }
}

questionAnswers(3)

yourAnswerToTheQuestion