19

I am creating an application which has five tabs at the bottom of the screen, each of which opens a different Activity.

My Tab Activity extends TabActivity which I have just read is deprecated and I should use Fragments instead.

How do I change my app to use Fragments instead? I have read the information on android.developer.com but I still have no idea how to do this.

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
sam
  • 2,469
  • 8
  • 37
  • 57
  • In 2016, use TabLayout from Design Support Library https://guides.codepath.com/android/google-play-style-tabs-using-tablayout – EpicPandaForce Aug 21 '16 at 09:16

1 Answers1

13

You will need to use the android compatibility library to use fragments. It can be found as a jar file in your android sdk folder.

There are many tutorials out there for fragments.

There is a project named ActionBarSherlock which demos all the capability of the compatibility library. Source code is also available on github. The link is on there site.

This is another tutorial http://mobile.tutsplus.com/tutorials/android/android-compatibility-working-with-fragments/

blessanm86
  • 31,439
  • 14
  • 68
  • 79