title: How to set OnPageChangeListener for Multiple ViewPagers in xamarin
body: <p>Hi I am stuck at a point where I am using two view pagers in same activity,
  First one is working perfectly when I am Implimenting OnpagechangeListener. 
  For second one I am making a different class to differentiate the two viewPagers but it is not working. This ques is very much similar to <a href="https://stackoverflow.com/questions/22895978/how-to-set-onpagechangelistener-for-multiple-viewpagers">How to set OnPageChangeListener for Multiple ViewPagers</a>
  below is my code for the class to implement second view pager</p>
  
  <pre><code>using System;
  using Android.Support.V4.View;
  using Android.App;
  
  namespace Running2Win.Droid
  {
      public class MyPagerIndicator : Android.Support.V4.View.ViewPager.IOnPageChangeListener{
          #region IOnPageChangeListener implementation
  
          public MyPagerIndicator(ViewPager vp){
              vp.AddOnPageChangeListener (this);
          }
  
          public void OnPageScrollStateChanged (int state){   
              Console.WriteLine("OnPageScrollStateChanged"+ state);
          }
  
          public void OnPageScrolled (int position, float positionOffset, int positionOffsetPixels){Console.WriteLine("OnPageScrolled");}
  
          public void OnPageSelected (int position)
          {
              switch (position) {
              case 0:
                  Console.WriteLine("Case 0"+position);
                  HomePageActivity.dot_down_one.SetImageResource (Resource.Drawable.dot_arrow_active);
                  HomePageActivity.dot_down_two.SetImageResource (Resource.Drawable.dot_arrow);
                  HomePageActivity.dot_down_three.SetImageResource (Resource.Drawable.dot_arrow);
                  break;
              case 1:
                  Console.WriteLine("case1"+ position);
                  HomePageActivity.dot_down_two.SetImageResource (Resource.Drawable.dot_arrow_active);
                  HomePageActivity.dot_down_three.SetImageResource (Resource.Drawable.dot_arrow);
                  HomePageActivity.dot_down_one.SetImageResource (Resource.Drawable.dot_arrow);
                  break;
              case 2:
                  Console.WriteLine("case2"+ position);
                  HomePageActivity.dot_down_three.SetImageResource (Resource.Drawable.dot_arrow_active);
                  HomePageActivity.dot_down_two.SetImageResource (Resource.Drawable.dot_arrow);
                  HomePageActivity.dot_down_one.SetImageResource (Resource.Drawable.dot_arrow);
                  break;
  
              default:
                  //                  Console.WriteLine("Default case"+position);
                  //                  HomePageActivity.dot_one.SetImageResource (Resource.Drawable.dot_arrow_active);
                  //                  HomePageActivity.dot_two.SetImageResource (Resource.Drawable.dot_arrow);
                  //                  HomePageActivity.dot_three.SetImageResource (Resource.Drawable.dot_arrow);
                  break;
              }
          }
  
          #endregion
  
          #region IDisposable implementation
  
          public void Dispose ()
          {}
  
          #endregion
  
          #region IJavaObject implementation
  
          public IntPtr Handle {
              get {
                  return (System.IntPtr)0;
              }
          }
  
          #endregion
  
  
  
  
  
      }
  
  }
  </code></pre>
  
  <p>from my main activity I am passing instance of the view pager in the constructor </p>