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
0 answers

Android ViewPager scroll limited times smoothly

I have a list of fragments implemented together with FragmentStatePagerAdapter. I must replace the current fragment with a new one each time the button don't like will be clicked. The problem with the ViewPager. In my case the ViewPager scroll…
1
vote
0 answers

FragmentStatePagerAdapter getItem not working

I have a viewpager with PagerTitleStrip.I adaptered my FragmentStatePagerAdapter successfully. This is a my source: public class CardsDetailsNewFragment extends MainFragment { private Card mCurrentCard; private View mView; private…
1
vote
1 answer

FragmentStatePagerAdapter returning wrong position to TextView

Ok, I have an Activity where I have viewpager and textview. Then I Have adapter that extends FragmentStatePagerAdapter, here is the code for it: public AdapterCustomPage(FragmentManager fm, Context context, TextView TV ) { super(fm); …
1
vote
0 answers

FragmentStatePageAdapter doesn't remove child fragments

Having a problem with FragmentStatePagerAdapter and screen change orientation (saving state I guess). The layout of my app is the following: Activity --> Fragment A Fragment B (contains a FragmentStatePagerAdapter) wich shows 2…
1
vote
0 answers

Why does FragmentStatePagerAdapter catch exceptions silently?

I found that FragmentStatePagerAdapter(or something else, maybe ViewPager, I don't know) catches exceptions silently and causes ANR. For Example: import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import…
1
vote
1 answer

Viewpager with fragmentstatepageradapter does not call oncreateview on a previous fragment

My viewpager is set with offscreenpagelimit 1 (default) When i scroll my viewpager to the right, oncreateview is called on the fragment with the current position +1 to prepare the next fragment. But when i swipe to the 3rd fragment and go back to…
Joske369
  • 505
  • 1
  • 6
  • 18
1
vote
2 answers

Android - disable forward swipe on data not filled correctly

I have an activity that manages instances of some sequential fragments and a ViewPager whose adapter is of type FragmentStatePagerAdapter. This fragments are sequentials because I want to create a sort of wizard that people must follow. All works…
1
vote
0 answers

viewPager within dynamic Fragment, wrong state position

before, thanks lot for take time for my questions ! I have a BIG problem in my project, I used viewPager within dynamic Fragment 6 fragments used so i extend FragmentStatePagerAdapter() for in my Activity. i want to swipe automatically from state…
1
vote
1 answer

Android ViewPager setAdapter can't update views and fragments

I have an FragmentActivity holding a entry button and a viewpager. When the entry button clicked, it will set an image url to a new FragmentPagerAdapter and set the adapter to viewpager. And the FragmentPagerAdpater is holding fragment that shows…
1
vote
2 answers

How to add a tab to SlidingTabLayout?

I am using google's SlidingTabLayout in my view, but i want to add dynamically new tabs to it. I'm using this http://developer.android.com/samples/SlidingTabsBasic/src/com.example.android.common/view/SlidingTabLayout.html This is my code which…
1
vote
0 answers

Android ViewPager, timer and asyncTask, swipe freez

Hello, first of all, i'am new in android development. I want do to a viewpager with 3 fragments visible, each fragment has a clock-timer and a list with a animated(blink) background. Each 10 seconds i do a call to my server,after response, update…
1
vote
1 answer

Fragments in are not restored after orientation change

In my program, I have the following hierarchy: Activity Fragment ViewPager + FragmentStatePagerAdapter Fragment containing video The fragment that is nested immediately in the activity is initialized using…
1
vote
1 answer

ViewPager showing fragments with the same data when should be treating each fragment individually

I am a relative newbie to android programming and I am having some issues. I'm am trying to attach fragments to a view pager for a todo application. I have 7 fragments that repersent each day. Each fragment loads correctly, but when I add a task,…
1
vote
0 answers

FragmentStatePagerAdapter with dynamic data, IllegalStateException

I have a main fragment that has list of items, on clicking an item, I open detailed view of item in a new fragment using transaction.replace(R.id.container, FeedDetail.newInstance(title, position)).commit(); The detailed fragment has…
1
vote
1 answer

Android view Pager flip more pages on swipe

I am using ViewPager with FragmentStatePageAdapter to show a number of views where user can go through. With current implementation only one page is changed at any single swipe. Instead I want to flip through multiple views based on user swipe. If…