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
0
votes
1 answer

Android ViewPager - access view inside the current page throws NPE

I'm using android.support.v4.view.ViewPager and noticed, that after setting my android.support.v4.app.FragmentStatePagerAdapter on the ViewPager in the onStart()-method of my activity I can't retrieve a view of the currently displayed ViewPager…
0
votes
2 answers

Replacing a fragment in another fragment in a ViewPager

I am absolutely new to Android programming and I am having difficulty in getting this to work (i am fairly close, but I am missing something important). I have an Activity called PatientPagerActivity, which pages through Fragments of Patient…
0
votes
1 answer

SupportMapFragment on FragmentStatePagerAdapter. I can see only previous and first map fragment

I'm working on googlemap carousel (pager) project and need to show google map inside complex layout, but every time I move the pager, mapfragment is not loading. if I flip back, the map suddenly appear. Here is my code: MainActivity import…
0
votes
1 answer

Android -FragmentStatePagerAdapter change amount of Fragments instantiated

FragmentStatePagerAdapter creates about 3 fragments each time. I'd like it to create say 10 fragments to populate the viewpager at once. I dont see any methods to change the default. Im dealing with a large number of items and each fragment in…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
0
votes
0 answers

Error occur in FragmentStatePagerAdapter?

Here is the code line where I am getting the error: ImagePagerAdapter adapter = new ImagePagerAdapter(((Activity)getContext()).getFragmentManager()); Error is not coming at the runTime, It comes in the project. when I take the cursor on error and…
Akarsh M
  • 1,629
  • 2
  • 24
  • 47
0
votes
1 answer

How modify Adapter Data Withoud Calling notifyDataSetChanged

I have a FragmentStatePagerAdapter, and it have a lot of "pages", that may be added or removed by the user. When an page gain focus, it have to load it contents from the database. My problem is when the adapter have 2 pages or more , and add a new…
0
votes
1 answer

FragmentStatePagerAdapter instantiates all fragments after updating to ADT 22

My app was working with the android support library rev 12 but when I updated to revision 13, my FragmentStatePagerAdapter started driving me nuts: My activity: import android.app.Fragment; import android.app.FragmentManager; import…
0
votes
1 answer

refresh listView by clicking outside of it

I have a viewpager with an adapter that extends FragmentStatePagerAdapter, this has to show some fragment that always repeats the same layout (in whic there is a listView) for every page ... now the problem is how can I update the listView that is…
0
votes
2 answers

Load content of ViewPager before paging

How can I load next page content of a ViewPager before paging. Imagine I'm using a ViewPager to display a book and each page is a fragment which is added to the ViewPager and I want the fragment being loaded before paging the book and user didn't…
Soheil Setayeshi
  • 2,343
  • 2
  • 31
  • 43
0
votes
2 answers

update views/slides (fragments) in FragmentStatePagerAdapter - simple reordering

I have tried using an extended FragmentStatePagerAdapter and an extended FragmentPagerAdapter to achieve what I'm trying and neither seem to work. I am sending down a JSON object from my server to fill an object model on the android client. On…
0
votes
1 answer

Android ViewPager adapter modify other pages

I have a Viewpager that uses a FragmentStatePagerAdapter. Each page is a Fragment. My pages contains an linearlayout (llTags) which is default visible. If the user clicks on a page (main layout of the fragment), the linearlayout must be invisible…
0
votes
1 answer

How to loop (from last fragment to first) in a FragmentStatePagerAdapter

I've written this class that extends FragmentStatePagerAdapter in order to swipe between views. Now I need to make the swiping list circular so that swiping after the last fragment would display the first fragment. I haven't found a way to properly…
wallen
  • 311
  • 1
  • 4
  • 13
-1
votes
4 answers

Java making switch case statment shorter

I have this switch case statement in my FragmentStatePagerAdapter. And I have looked into many similar questions but none have provided a shorter answer, meaning the switch cases are still in their code. This code is really repetitive and ugly to…
Richard
  • 1,087
  • 18
  • 52
-1
votes
1 answer

FragmentPagerAdapter shows wrong fragment after data change

I have a simple FragmentPagerAdaper, and I have overriden the getItem and getCount methods. Everything works fine until I change the data. Even after calling notifyDataSetChanged, the ViewPager is showing the old fragment, even tough I am not…
Vedant Agarwala
  • 18,146
  • 4
  • 66
  • 89
-1
votes
1 answer

Refresh a fragment inside a viewpager which is inside a fragment

I have an activity which consists of three fragments. In one of these fragments I have a viewpager that consists of three other fragments. I call getChildFragmentManager() inside fragment that has viewpager in it. I have searched SO and read almost…
1 2 3
26
27