Search code examples
javaandroidandroid-tabhost

How to implement tabs now that TabActivity is deprecated


I am trying to implement some simple tabs in an activity.
I think I have the xml code ok (I am using the minimal tabHost/widget/FrameLayout found in example code), I am however having issues with the java side.
Most of the documentation on how to do this point to using TabWidget, this class is now deprecated. It is suggested that one should use fragments. But fragments seem to be used in a rather different manner.
Has someone go some sample code of how to implement in java some very basic tabs defined in an xml file now that TabHost is deprecated.(the example [here[1 does not use xml )


Solution

  • If you go to the Android developer guide they show you how this can be done

    http://developer.android.com/reference/android/app/TabActivity.html

    There is example code that shows you how to do this using fragments