Post reply
[image: More message actions]
 8:11 PM (less than a minute ago) 
  Unfortunately this is really not straightforward. You'll have to work 
around in order to make that work. You basically have the following 
possibilities:

1. You can get the currently visible page index number from the pager. Use 
that number to get the correct fragment from your adapter. But be careful: 
your adapter needs to internally cache the created fragments, otherwise you 
can always get a new instance of your fragment.

2. You can let your Fragment itself tell your Activity that it is currently 
visible. You can check that in your fragment by calling 
Fragment.getUserVisibleHint(). Use the latest version of 
Fragment(State)PagerAdapter. Previous versions did not set that hint 
correctly.


On Monday, January 28, 2013 4:29:05 PM UTC-6, dashman wrote:
>
> I've got a FragmentActivity sub-class app with a ViewPager.
>
> also has a .PagerTitleStrip.
>
> Essentially a view with about 4 Fragments that can be laterally navigated.
>
> How can I find the active Fragment on the screen.
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to