Grant,

I think the reason might be that you can't rely on a one-to-one
correspondence between the item ordering in the ViewPager's collection
and order of your pages. Check out your PagerAdapter implementation
and look to see how your page items are added to the collection in
instantiateItem.

An alternative approach might be to define an id on the root element
of each page root view and call findViewById on your ViewPager object,
instead of getChildAt.

Cheers,

Stephen

On Sep 6, 11:01 am, Grant Thomas <jgranttho...@gmail.com> wrote:
> Hi all,
> any insights into how you might get the current focused item in a
> viewpager.  I've found that the index received in my
> OnPageChangeListener is not a good argument to pass along to
> ViewPager's getChildAt method (i.e.,  the view I reference seems not
> to always be the one it ought to be, could be one of the views that's
> not currently visible etc...).
>
> Any insights?
>
> I'm interested mostly in having the current visible view attempt to
> handle touches before my viewpager tries.  The best I can do right now
> is to have both the focused view and the pager handle the touch event,
> which is resulting in some less than ideal behavior.  If it's not
> simple to get the current view, I'd settle for having my views catch
> touch events before the pager and pass them along in the case that
> they ought to.
>
> Thanks,
> Grant

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to