Pdroid
Pdroid

Reputation: 867

Use fragments ans swipe views without extend fragmentsActivity

my main activity have classic tabs, I want to implement swipable tabs in my main actuvity, But in every tutorial/guide I've found, each time main activity extends FragmentActivity :

public class MainActivity extends FragmentActivity implements ActionBar.TabListener {

But, I have other things in my activity, so my main activity extends Activity, My a question is : how to add all fragments, view pager and other methods, in activity that just extend activity ?

Source http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/

Upvotes: 0

Views: 82

Answers (1)

tbruyelle
tbruyelle

Reputation: 13045

To host fragments, an activity needs the FragmentManager and so needs to extend FragmentActivity, the one from the standard library, or the one from the Support library.

There is no other choice.

Upvotes: 1

Related Questions