Search code examples
androidandroid-tabhost

The Type TabActivity is deprecated


I trying to extends my main class from TabActivity ... I wrote the code as bellow :

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class AndroidTabAndListView extends TabActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    .
    .
    .
.
.
}

but I have a worning that the type TabActivity is deprecated !!!!!

enter image description here

Have any one any Idea about this ???

thank you in advance , Fadel


Solution

  • Please see the official document.

    This class was deprecated in API level 13. New applications should use Fragments instead of this class; to continue to run on older devices, you can use the v4 support library which provides a version of the Fragment API that is compatible down to DONUT.

    See also:

    "The type TabActivity is deprecated" For app tab

    https://stackoverflow.com/questions/12600207/the-type-tabactivity-is-deprecated-help-to-use-in-older-device

    Android: TabActivity deprecated, use Fragments?

    Or if you have a more specific question, you can add more info.