Questions tagged [fragmentpageradapter]

FragmentPagerAdapter is a subclass of the PagerAdapter class from the Android compatibility package that represents each page, in the ViewPager where is used, as a Fragment.

FragmentPagerAdapter represent each page as a Fragment. This adapter class should be used only when there is a limited number of Fragments to swipe in the ViewPager. Using the FragmentPagerAdapter would require at minimum implementing the getItem()(to return the Fragment for this position) and getCount()(to return the number of Fragments in this adapter) methods.


From the documentation of the FragmentPagerAdapter class:

Implementation of PagerAdapter that represents each page as a Fragment that is persistently kept in the fragment manager as long as the user can return to the page.

This version of the pager is best for use when there are a handful of typically more static fragments to be paged through, such as a set of tabs. The fragment of each page the user visits will be kept in memory, though its view hierarchy may be destroyed when not visible. This can result in using a significant amount of memory since fragment instances can hold on to an arbitrary amount of state. For larger sets of pages, consider FragmentStatePagerAdapter.

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:

602 questions
0
votes
1 answer

How to use Android FragmentPagerAdapter with MapView

I'm pretty new to Android programming so pardon my noobness. I tried using some sample code from the Android tutorial site. I'm trying to get a mapview into a FragmentPagerAdapter. I managed to get both separate sample codes running on their own but…
Julien
  • 185
  • 1
  • 2
  • 15
0
votes
1 answer

Removing/Adding a Page to ViewPager

I'm trying to make a layout that is essentially a fragment consisting of 3 vertically scrolling lists. Clicking an item in the list will populate the list to its immediate right with appropriate data, and so on. When an item in the right-most list…
user1549672
  • 486
  • 1
  • 6
  • 16
0
votes
1 answer

Need to hit this nail on the head... retaining fragment and view onConfigurationChange

We have a web service which serves up an XML file via a HTTP Post. I am downloading and parsing this xml file into an object to populate some views inside a couple of fragments held in a FragmentPagerAdapter. I get this XML file via an AsyncTask and…
Karl
  • 3,394
  • 2
  • 22
  • 31
0
votes
1 answer

how can i use array list of activities instead of using multiple fragments

in my project which about viewing multiple activities with swipe i have been used the fragments idea and my code work very well ,, but this morning my manager asked me to convert the array list of fragments to array list of activities but really i…
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
0 answers

FragmentPagerAdapter returns a nullpointerexception

I am trying to add tabs to the action bar in my android application. Using FragmentPagerAdapter seems a nice idea but when I try to set the adapter to the ViewPager object, it returns a nullpointerexception. Cannot figure out th problem, please…
Anas
  • 177
  • 1
  • 11
0
votes
1 answer

Share ViewPager text showing previous Fragment text

I want to share TextView content which is displayed on ViewPager via FragmentPagerAdapter but when I share the content it share previously focused TextView Content. When I click on Share button it share the content of the last Fragment …
Ved
  • 1,035
  • 14
  • 28
0
votes
1 answer

how can I dynamic add fragment on the reference of default Android FragmentActivity sample?

reference the default sample of FragmentActivity like that: package com.example.test2; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import…
0
votes
0 answers

Android FragmentPagerAdapter findViewById

I have a Layout which load a FragmentPagerAdapter with 3 Pages. Simple problem, I can't find any View with findViewById, and I have been searching around for 2 days can't find the solution for this :( Did I miss anything here? Any good example to…
s k
  • 4,342
  • 3
  • 42
  • 61
0
votes
1 answer

Open new activity using intent on FragmentPagerAdapter

i want open new activity (List Activity) List.java under Tile Strip how to use intent on the onCreateView OR How To add List On the onCreateView main.java is Sample for Swipe View and Tile Strip on the Eclipse Main.java : import…
Khode_Erfan
  • 184
  • 1
  • 2
  • 8
0
votes
1 answer

FragmentPagerAdapter don't want page titles

I do not want page titles on my fragment pages, but when I remove the getPageTitle segment, or set the strings to "", there is a space on the top of each fragment that I cannot get rid of. Any advice?
0
votes
0 answers

Vertical Sliding For Fragments

Is there any way to Vertical sliding for Fragments in Android? I mean something like FragmentPagerAdapter but in vertical mode. I need this to write a text viewer with vertical sliding pages, something like pdf readers.
0
votes
2 answers

How to edit a fragment and save its state?

I have to add TextViews and EditTexts in a Fragment ( Details() ) when i click in a button ( Button add ). I was able to insert them, but when i swipe my 6 fragments and return in the first fragment this items disappear. Can someone help…
0
votes
2 answers

Why cannot I detach fragment from FragmentPagerAdapter?

I would like to detach a fragment from my FragmentPagerAdapter, but it doesnt seem to be working. Here is my pageradapter class, which I copied from the original code: public class PagerAdapter1 extends FragmentPagerAdapter { private…
Jani Bela
  • 1,660
  • 4
  • 27
  • 50
0
votes
1 answer

FragmentPagerAdapter implementing LoaderManager.LoaderCallbacks

Im trying to implement a FragmentPagerAdapter with a cursor loader. However, it seems that I am unable to access the cursor within getItem() as I get a null reference error when attempting to access the cursor as it is not been set yet in…