MBMJ
MBMJ

Reputation: 5431

What should i do when the TabActivity is in deprecation?

I tried make a project using tab activity.But the problem is when i declare the tab activity its not working.When i put my mouse on it it shows this documents

This class is deprecated. 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..... bla.....bla....bla.

I thought my padding was not right,so i fix the xml.But it still the same.This my xml for Tab.

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
    android:orientation="vertical"
    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" />
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>
</LinearLayout>
</TabHost>

How can i solve the problem?

Upvotes: 2

Views: 1386

Answers (2)

jeet
jeet

Reputation: 29199

I Think you are implementing TabGroupActivity Implementation to your application, which setCOntent to tab to an activityGroup, ActivityGroup has been deprecated from the Android Api, So as per suggestion you should use Fragments instead of TabGroup. See examples:

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html

http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/

Upvotes: 2

In the world of software development, "deprecated" refers to functions or elements that are in the process of being replaced by newer ones, So instead of TabActivity you can go for FragmentTabs.

Upvotes: 4

Related Questions