All Questions

211
votes
22answers
131568 views

Retrieve a Fragment from a ViewPager

I'm using a ViewPager together with a FragmentStatePagerAdapter to host three different fragments: [Fragment1] [Fragment2] [Fragment3] When I want to get Fragment1 from the ViewPager in the Fragme...
493
votes
35answers
288042 views

ViewPager PagerAdapter not updating the View

I'm using the ViewPager from the compatibility library. I have succussfully got it displaying several views which I can page through. However, I'm having a hard time figuring out how to update the Vi...
235
votes
17answers
154369 views

Replace Fragment inside a ViewPager

I'm trying to use Fragment with a ViewPager using the FragmentPagerAdapter. What I'm looking for to achieve is to replace a fragment, positioned on the first page of the ViewPager, with another one. ...
163
votes
6answers
213531 views

How to implement a ViewPager with different Fragments / Layouts

When I start an activity which implements viewpager, the viewpager created various fragments. I want to use different layouts for each fragment, but the problem is that viewpager shows only two layout...
571
votes
22answers
215434 views

How to determine when Fragment becomes visible in ViewPager

Problem: Fragment onResume() in ViewPager is fired before the fragment becomes actually visible. For example, I have 2 fragments with ViewPager and FragmentPagerAdapter. The second fragment is only a...
441
votes
10answers
200707 views

ViewPager and fragments — what's the right way to store fragment's state?

Fragments seem to be very nice for separation of UI logic into some modules. But along with ViewPager its lifecycle is still misty to me. So Guru thoughts are badly needed! Edit See dumb solution b...
254
votes
18answers
216610 views

Update ViewPager dynamically?

I can't update the content in ViewPager. A question: What is the relationship and correct usage of methods instantiateItem() and getItem() in FragmentPagerAdapter class? I was using only getItem() t...
371
votes
14answers
202110 views

How do disable paging by swiping with finger in ViewPager but still be able to swipe programmatically?

I have ViewPager and below it I have 10 buttons. By clicking on button, for example #4, the pager goes immediately to page #4 by mPager.setCurrentItem(3);. But, I want to disable the paging by swiping...
109
votes
14answers
62137 views

Android: Vertical ViewPager

Is there a way to make a ViewPager that does not scroll horizontally, but vertically?!
136
votes
9answers
67048 views

Update data in ListFragment as part of ViewPager

I'm using the v4 compatibility ViewPager in Android. My FragmentActivity has a bunch of data which is to be displayed in different ways on different pages in my ViewPager. So far I just have 3 insta...

Previous Next