1

I notice that TabHost is deprecated.

enter image description here

But, when I run my application in my mobile. I notice that it properly working with no error.

Why? In which android version TabHost won't work.

My android version : Lollipop/5.1, Android API level : 22.

Should I work with it? Or, I have to use ViewPager and TabLayout.

<TabHost
    android:id="@+id/tab_host"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@id/rl_">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <LinearLayout
                android:id="@+id/Filters"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <include
                    layout="@layout/filters_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/Adjustments"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

            </LinearLayout>

        </FrameLayout>

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#40cccccc" />

    </LinearLayout>
</TabHost>
  • `TabHost` was deprecated for some reason, it's always best to avoid using deprecated classes and migrate to currently supported/suggested – snachmsm Jan 27 '21 at 09:14
  • `I notice that it properly working with no error.` sure, deprecated doesn't mean that it won't work, it's just saying it might be removed soon and you should find the alternative – a_local_nobody Jan 27 '21 at 09:21
  • @a_local_nobody What's the better alternative of it? –  Jan 27 '21 at 09:23
  • @snachmsm What's the better alternative of it? –  Jan 27 '21 at 09:23
  • i don't think there's anything like a tab host anymore, perhaps a viewpager – a_local_nobody Jan 27 '21 at 09:25
  • @a_local_nobody I didn't use `TabActivity`. I am just working with `FrameLayout`, `TabWidget` and `TabHost`. –  Jan 27 '21 at 09:27
  • @a_local_nobody Check my source code. I think I can use the source code, can't I? –  Jan 27 '21 at 09:29
  • 1
    deprecated really just means there's probably a better/newer way of doing something, it doesn't mean your code won't work, that's the link i sent you. – a_local_nobody Jan 27 '21 at 09:30
  • @a_local_nobody Does it mean I can use it in every Android Version? –  Jan 27 '21 at 09:31

0 Answers0