I\'m going to create an application which is designed to use Tabhost, but as I know it\'s been deprecated. So my question is should I use Tabhost a
was deprecated in API level 30. You can use material TabHostTabLayout and ViewPager instead of :TabHost
code:
tablayout.addTab(tablayout.newTab().setText("Tab1"))
tablayout.addTab(tablayout.newTab().setText("Tab2"))
tablayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabReselected(tab: TabLayout.Tab?) {
}
override fun onTabUnselected(tab: TabLayout.Tab?) {
}
override fun onTabSelected(tab: TabLayout.Tab?) {
// do something
}
})