title: How to add gesture detector to a ViewPager
body: <p><strong>What I want to do:</strong></p>
  
  <p>Image will be slidable  by viewpager but people can zoomIn or zoomOut by gesture detector.</p>
  
  <p><strong>Problem:</strong></p>
  
  <p>I can slide image using viewpager but don't know to how to add gesture detector in my Viewpager.</p>
  
  <p><strong>Code:</strong></p>
  
  <p>Activity:</p>
  
  <pre><code>    public class ImageSlider extends AppCompatActivity {
      private ViewPager viewPager;
      CustomSwipeAdpater customSwipeAdpater;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_image_slider);
          viewPager = (ViewPager) findViewById(R.id.pager);
          customSwipeAdpater = new CustomSwipeAdpater(this);
          viewPager.setAdapter(customSwipeAdpater);
      }
  }
  </code></pre>
  
  <p>PagerAdpater:</p>
  
  <pre><code>    public class CustomSwipeAdpater extends PagerAdapter {
      private int[] image_resources = {R.drawable.wall,R.drawable.welcome};
      private Context context;
      private LayoutInflater inflater;
      private Animator mCurrentAnimator;
      private ImageView imageView;
  
      public CustomSwipeAdpater(Context context){
          this.context = context;
  
      }
  
      @Override
      public int getCount() {
          return image_resources.length;
      }
  
      @Override
      public boolean isViewFromObject(View view, Object object) {
          return (view == (RelativeLayout)object);
      }
  
      @Override
      public Object instantiateItem(ViewGroup container, final int position) {
          inflater = (LayoutInflater)context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
  
          View item_view = inflater.inflate(R.layout. swipe_layout,container,false);
          imageView = (ImageView) item_view.findViewById(R.id.ivSliderImage);
          TextView textView = (TextView) item_view.findViewById(R.id.tvSliderImageText);
          imageView.setImageResource(image_resources[position]);
          textView.setText("Image:" + position);
          container.addView(item_view);
          imageView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
              }
          });
          return item_view;
      }
  
      @Override
      public void destroyItem(ViewGroup container, int position, Object object) {
          container.removeView((RelativeLayout) object);
      }
  }
  </code></pre>
  
  <p><strong>How to add gesture Detector in this code?</strong></p>