0

My problem

I am using ViewPager with custom FragmentPagerAdapter - ThreePageAdapter. ThreePageAdapter consist of 3 pages of WrapperFragment. I use ThreePageAdapter.addFirstPage(Fragment pFragment) to add fragments into ThreePageAdapter. If I minimize my app it will destroy ThreePageAdapter. And when I open app again, the app will start onCreate() method again. I think it is wrong.

My question

Should I make my ThreePageAdapter implements Parcelable to put it into Bundle at onSaveInstanceState() method? Is it a good practice?

I would greatly appreciate for your help. Alex. P.S. Sorry for my English:)

AlexMomotov
  • 7,418
  • 8
  • 24
  • 34

1 Answers1

1

To store fragment in bundle you can try Something Like this

getSupportFragmentManager().putFragment(outState, "tag", content);

where outState is Bundle, tag is String, content is Fragment