Questions tagged [fragmentstatepageradapter]

Implementation of PagerAdapter class from the Android compatibility package that uses a Fragment to manage each page. This class also handles saving and restoring of fragment's state.

This version of the pager is more useful when there are a large number of pages, working more like a list view. When pages are not visible to the user, their entire fragment may be destroyed, only keeping the saved state of that fragment. This allows the pager to hold on to much less memory associated with each visited page as compared to FragmentPagerAdapter at the cost of potentially more overhead when switching between pages.


From the documentation of the FragmentStatePagerAdapter class:

Implementation of PagerAdapter that uses a Fragment to manage each page. This class also handles saving and restoring of fragment's state.

This version of the pager is more useful when there are a large number of pages, working more like a list view. When pages are not visible to the user, their entire fragment may be destroyed, only keeping the saved state of that fragment. This allows the pager to hold on to much less memory associated with each visited page as compared to FragmentPagerAdapter at the cost of potentially more overhead when switching between pages.

When using FragmentPagerAdapter the host ViewPager must have a valid ID set.

Subclasses only need to implement getItem(int) and getCount() to have a working adapter.

Tag Usage:

397 questions
1
vote
1 answer

How to add Fragments in ViewPager from getView

Can any one help me , How to add ViewPager using FragmentStatePageAdapter in getView. I am using https://github.com/Diolor/Swipecards library . My requirement is to add viewpager at every card from using FrgamentStatePageAdapter. But after…
1
vote
0 answers

Using ViewPager inside Recyclerview won't show all pages of all items

I have some sliders inside recyclerview among some other items. this is my pager adapter: class PagerFragmentAdapter extends FragmentStatePagerAdapter { public PagerFragmentAdapter(FragmentManager fm) { super(fm); } …
1
vote
0 answers
1
vote
0 answers

Certain Android Devices Not Rendering ViewPager / Fragment

I am using AWS device farm to test the appearance of my home page on all devices that run Android. My basic home screen is a main activity that hosts a viewpager. For some odd reason, some of the devices in the AWS test are not loading the viewpager…
tccpg288
  • 3,242
  • 5
  • 35
  • 80
1
vote
0 answers

setEmptyView() on FragmentStatePagerAdapter

Is there a nice and easy way to set an empty View on a FragmentStatePagerAdapter? A bit like the same way we do on ListView.setEmptyView(view). Indeed, I'm working with a FragmentStatePagerAdapter, with Data coming from a CursorLoader and it's not…
Andy Strife
  • 729
  • 1
  • 8
  • 27
1
vote
1 answer

ViewPager Fragment Not Updating Synchronously?

I have a MainActivity which first makes a call to my server and gets the response. Then, on the success of first response, i am initiating the viewPager. Below, code is called to initiate the viewPager and it's adapter, it is called only after the…
1
vote
0 answers

How to destroy a Fragment programmatically in FragmentStatePagerAdapter

I'm using the MainActivity's SearchView here to filter the listview which is showing under tabs but there is an issue of the state of Fragment. It filters perfectly but when I select first Tab(ADVISORY), then it filters the child of this Tab. And…
1
vote
1 answer

FragmentStatePagerAdapter with one fragment

I have a FragmentStatePagerAdapter where I want to display one and the same fragment multiple times.Because this fragment consist of a lot of views I'm looking for a way no to create that fragment every time user swipes occurs I just want to reload…
Radoslav
  • 1,446
  • 1
  • 16
  • 30
1
vote
0 answers

Android: How to scroll RecyclerView only by y-axis

I have a RecyclerView and TextView in a Fragment. FragmentStatePagerAdapter instantiates my Fragments for parent ViewPager. When I try to scroll to right or left on TextViews, it works great, but RecyclerViews intercept my swipes and ViewPager…
1
vote
0 answers

Crash - calling onFragmentCreated after onDestory() was called on parent

I got some crash trace from Crashlytics service and I need some help to understand what cause them. I use the next flow : I have my main GeneralActivity and inside that Activity I lunch a fragment that uses MyMainFragment and he uses ViewPager to…
1
vote
1 answer

The onCreateView() method is not invoked for the fragment containing a recyclerView. Im using a FragmentStatePagerAdapter as the ViewPagerAdapter

I have two fragments. 1) A fragment with just a TextView(OneFragment) 2) A fragment with a recycler view who's contents are being populated in the onCreateView() of the Fragment (Two Fragment) In the Activity class I use a viewPager to control these…
1
vote
0 answers

Jazzy ViewPager with MVVMCROSS

Does someone know how to use the Xamarin Component Jazzy ViewPager with MvxFragments? Normally I use the FragmentStatePagerAdapter like this: public ObservableCollection ItemsSource { get { return _itemsSource; } set { …
1
vote
1 answer

Android FragmentStatePagerAdapter - Missing view

I have created a set of horizontal tabs and for each tab content it has a View pager which in turn allows the content of the view to be swiped. I am currently harcoding this to 3 views in the adaptor and returning a new inner fragment which…
berimbolo
  • 3,319
  • 8
  • 43
  • 78
1
vote
0 answers

Issue in frgment replace in FragmentStatePagerAdapter tabhoast matireal design android

i want to integrate tabhoast with material design android so i write below code public class ActivityPaymentModule extends AppCompatActivity implements MaterialTabListener { private ViewPager pager; private MaterialTabHost tabHost; private…
1
vote
1 answer

How do I disable swiping on FragmentStatePagerAdapter?

I'm following the tutorial here which uses a TabLayout with a FragmentStatePagerAdapter. Everything is great, except I need to disable swiping on my second tab, as it uses horizontal scrolling. It's okay if scrolling is disabled for all tabs, but It…