I am new to Android programming. I started building an app using YouTube tutorials but I am a little bit confused and facing a problem. Should I use fragments or activity in my sliding tab? I am working on an Android project of employee attendance and payroll so I am thinking of using a slide tab (something like the screenshot below). The 1st tab may contain a form to add an employee and after adding it, will display information in list view and the other may contain salary. Should I try fragment or activity for my tabs?
Asked
Active
Viewed 313 times
0
-
2Possible duplicate of [Dilemma: when to use Fragments vs Activities:](http://stackoverflow.com/questions/20306091/dilemma-when-to-use-fragments-vs-activities) – Michael Dodd Jan 08 '17 at 14:16
1 Answers
0
A fragment is always located in an activity.
So you wil always need an Activity and then add the fragment to the activity.
if you say you want to slide? you probably mean a viewpager, that can have n fragments. the viewpager needs a special viewpageradapter. where you define how many fragments you want. and at which index what fragment needs to be shown

vanlooverenkoen
- 2,121
- 26
- 50