Android Get Focused View From ViewPager

To get the focused view in a Android ViewPager call the OnPageSelected().

private int focused = 0;
private class MyPageChangeListener extends ViewPager.SimpleOnPageChangeListener {
    public void onPageSelected(int position) {
        focused = position;

Take a look at this interesting blogpost about ViewPager

Posted in Android, Tips and Tricks Tagged with: , ,