title: Get focused View from ViewPager
body: <p>i use the ViewPager for switching views with left/right swipe.</p>
  
  <p>The ViewPager needs an Adapter, so I've built this one:</p>
  
  <pre><code>public class ListViewPagerAdapter extends PagerAdapter {
  
  protected static final String TAG = "ListViewPagerAdapter";
  protected static final int NUM_VIEWS = 3;
  
  protected final Activity mActivity;
  
  public ListViewPagerAdapter(Activity activity) {
      mActivity = activity;
  }
  
  @Override
  public int getCount() {
      return NUM_VIEWS;
  }
  
  @Override
  public void startUpdate(View container) {}
  
  @Override
  public Object instantiateItem(View container, int position) {
      // ViewPager
      ViewPager viewPager = (ViewPager) container;
  
      // Wird verwendet, um die Views aufzurufen
      LayoutInflater layoutInflater = mActivity.getLayoutInflater();
  
      // Standardmäßig ist news eingeblendet
      View view = layoutInflater.inflate(R.layout.news_fragment, null);
      // Falls sich die Position verändert, so verändert sich auch die View
      if (position == 0) {
          view = layoutInflater.inflate(R.layout.favorite_fragment, null);
      } else if (position == 2) {
          view = layoutInflater.inflate(R.layout.videos_fragment, null);
      }
  
      // View einblenden
      viewPager.addView(view, 0);
  
      return view;
  }
  
  @Override
  public void destroyItem(View container, int position, Object object) {
      // ViewPager
      ViewPager viewPager = (ViewPager) container;
      // View
      View view = (View) object;
  
      // View löschen
      viewPager.removeView(view);
  }
  
  @Override
  public void finishUpdate(View container) {}
  
  @Override
  public boolean isViewFromObject(View view, Object object) {
      View _view = (View) object;
      return view == _view;
  }
  
  @Override
  public Parcelable saveState() {
      return null;
  }
  
  @Override
  public void restoreState(Parcelable state, ClassLoader loader) {}
   }
  </code></pre>
  
  <p>Now, i want to get the current focused view by the viewpager.
  I tried getChildAt(x), but it does not work.</p>
  
  <p>Are there some example, or do you have any idea how to get the current view?</p>
  
  <p>Thanks</p>