title: Android how to use Viewpager with OnTouchListener
body: <p>i am a coding beginner, so sorry for my bad explanation of the problem. </p>
  
  <p>In my MainActivity I have a full screen Viewpager, which changes its content (the xml-file) every time I swipe left or right. These collection of views is defined in a enum, I have also used a CustomPagerAdapter for that. 
  This works fine, but when I implement an onTouchListener in my MainActivity, the "swiping" doesn't work anymore.</p>
  
  <p>Does anyone know, how to solve that? </p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Main = (View) findViewById(R.id.MainActivity);
      viewPager = (ViewPager) findViewById(R.id.colorgroup);
      viewPager.setAdapter(new CustomPagerAdapter(this));
      View.OnTouchListener handleTouch = new View.OnTouchListener() {
      @Override
       public boolean onTouch(View v, MotionEvent event) {
              int x = (int) event.getX();
              int y = (int) event.getY();
              viewPager.setDrawingCacheEnabled(true);
              viewPager.buildDrawingCache();
              Bitmap bitmap = viewPager.getDrawingCache();
              int pixel = bitmap.getPixel(x, y);
              String hexColor = String.format( "#%02x%02x%02x", r, g, b );
              return true;
          }
      };
      viewPager.setOnTouchListener(handleTouch);
  } 
  </code></pre>
  
  <p>public class CustomPagerAdapter extends PagerAdapter {</p>
  
  <pre><code>private Context mContext;
  
  public CustomPagerAdapter(Context context) {
      mContext = context;
  }
  
  @Override
  public Object instantiateItem(ViewGroup collection, int position) {
      CustomPagerEnum customPagerEnum = CustomPagerEnum.values()[position];
      LayoutInflater inflater = LayoutInflater.from(mContext);
      ViewGroup layout = (ViewGroup) inflater.inflate(customPagerEnum.getLayoutResId(), collection, false);
      collection.addView(layout);
      return layout;
  }
  
  @Override
  public void destroyItem(ViewGroup collection, int position, Object view) {
      collection.removeView((View) view);
  }
  
  @Override
  public int getCount() {
      return CustomPagerEnum.values().length;
  }
  
  @Override
  public boolean isViewFromObject(View view, Object object) {
      return view == object;
  }
  
  @Override
  public CharSequence getPageTitle(int position) {
      CustomPagerEnum customPagerEnum = CustomPagerEnum.values()[position];
      return mContext.getString(customPagerEnum.getTitleResId());
  }
  </code></pre>
  
  <p>}</p>
  
  <p>public enum CustomPagerEnum {</p>
  
  <pre><code>YELLOW(R.string.YELLOW, R.layout.view_yellow),
  PUCE(R.string.PUCE, R.layout.view_puce),
  BROWN(R.string.BROWN, R.layout.view_brown),
  GREEN(R.string.GREEN, R.layout.view_green),
  CYAN(R.string.CYAN, R.layout.view_cyan),
  BLUE(R.string.BLUE, R.layout.view_blue),
  RED(R.string.RED, R.layout.view_red),
  PINK(R.string.PINK, R.layout.view_pink),
  PURPLE(R.string.PURPLE, R.layout.view_purple),
  SLATE(R.string.SLATE, R.layout.view_slate),
  GREY(R.string.GREY, R.layout.view_grey),
  DARK(R.string.DARK, R.layout.view_dark);
  
  
  
      private int mTitleResId;
      private int mLayoutResId;
  
      CustomPagerEnum(int titleResId, int layoutResId) {
          mTitleResId = titleResId;
          mLayoutResId = layoutResId;
      }
  
      public int getTitleResId() {
          return mTitleResId;
      }
  
      public int getLayoutResId() {
          return mLayoutResId;
      }
  </code></pre>
  
  <p>}</p>