0

I am new in Android. What is the main use FragmentPagerAdapter in Android, Is this same as like BaseAdapter ??

Where FragmentPagerAdapter is used and how does ??

Bot
  • 2,285
  • 3
  • 17
  • 20

1 Answers1

0

FragmentPagerAdapter is one of the PagerAdapters provided by the framework to use it in combination with ViewPager. In simple words, it provides the Fragments to be displayed as pages of the ViewPager.

In the other hand, BaseAdapter is the base class for all Adapters that will deal with ListViews.

Emmanuel
  • 13,083
  • 4
  • 39
  • 53
  • Yes. `FragmentStatePagerAdapter`. – Emmanuel Apr 05 '14 at 15:25
  • Can you tell me difference between them ? – Bot Apr 05 '14 at 15:26
  • Look at [this](http://stackoverflow.com/a/18748107/2029566) answer I gave some time back. – Emmanuel Apr 05 '14 at 15:29
  • I see, nice answer but I could not understand "The first Adapter might destroy View hierarchy and re load it when needed, the second Adapter only saves the state of the Fragment and completely destroys it, if the user then comes back to that page, the state is retrieved." – Bot Apr 05 '14 at 15:33
  • What don't you understand? – Emmanuel Apr 05 '14 at 15:34
  • Nothing sorry, what would be destroyed and on what action and why it destroys – Bot Apr 05 '14 at 15:36
  • `FragmentPagerAdapter` might destroy the `View` hierarchy completely (basically all the `Views` on that `Fragment'`s xml) when the user swipes away from it. `FragmentStatePagerAdapter` saves the sate of the `Fragment` and completely destroys the `Fragment`. – Emmanuel Apr 05 '14 at 15:40
  • Okay got you any mean to save the state ?? – Bot Apr 05 '14 at 15:43
  • You are saying "FragmentStatePagerAdapter saves the sate of the Fragment" , what state and any mean to save it ? – Bot Apr 05 '14 at 15:49
  • I think you should read the [`FragmentStatePagerAdapter`](http://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter.html) docs. – Emmanuel Apr 05 '14 at 15:53