Write your own adapter. ViewPager knows nothing about fragments; that is the job of the adapter.
You can take one of the existing adapters and modify it to do what you want; they are not very complicated. On Sat, Sep 17, 2011 at 4:34 PM, Francisco Figueiredo Jr. < [email protected]> wrote: > > Hi! I think it may be a little bit offtopic, but as you are talking about > changing PageAdapter and ViewPager apis, I'd like to ask if it is possible > to expose some method to get the fragment after you have added it to a > ViewPager. > > I'm asking that because if you have to handle a ScreenOrientation after the > fragment has been added, there is no way to get a reference to them later, > unless you keep a reference to your fragments in a static variable. Another > approach I used was to use the FragmentManager.putFragment() method to keep > the fragment reference for me. > > I noticed the FragmentPagerAdapter adds the fragments with a tag based on > his position and parent id through the method makeFragmentName. I think it > would be nice if external code could get access to this method so we could > have access to the fragments inside the viewpager through the > findFragmentByTag(). > > Thanks in advance. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

