title: Zooming event not working on ImageView in android
body: <p>I have made a demo in android for overlapping the two images.means select any image from gallery and put any sticker on it,we can zoom and drag and move that sticker too.I have made move moment event successful,but zooming event is not working,Please help me.My code is as below:</p>
  
  <pre><code>imageDetail.setOnTouchListener(new View.OnTouchListener() {
          @SuppressLint("ClickableViewAccessibility") @Override
          public boolean onTouch(View v, MotionEvent event) {
  
              ImageView view = (ImageView) v;
              System.out.println("matrix=" + savedMatrix.toString());
  
  
              switch (event.getAction() &amp; MotionEvent.ACTION_MASK) {
              case MotionEvent.ACTION_DOWN:
  
                  savedMatrix.set(matrix);
                  startPoint.set(event.getX(), event.getY());
                  mode = DRAG;
                  break;
  
              case MotionEvent.ACTION_POINTER_DOWN:
  
                  oldDist = spacing(event);
                  if (oldDist &gt; 10f) {
                      savedMatrix.set(matrix);
                      midPoint(midPoint, event);
                      mode = ZOOM;
                  }
                  break;
  
              case MotionEvent.ACTION_UP:
  
              case MotionEvent.ACTION_POINTER_UP:
                  mode = NONE;
  
                  break;
  
              case MotionEvent.ACTION_MOVE:
                  if (mode == DRAG) {
                      matrix.set(savedMatrix);
                      matrix.postTranslate(event.getX() - startPoint.x,
                              event.getY() - startPoint.y);
                  } else if (mode == ZOOM) {
                      float newDist = spacing(event);
                      if (newDist &gt; 10f) {
                          matrix.set(savedMatrix);
                          float scale = newDist / oldDist;
                          matrix.postScale(scale, scale, midPoint.x, midPoint.y);
                      }
                  }
                  break;
              }
              view.setImageMatrix(matrix);
  
              return true;
          }
  
          @SuppressLint("FloatMath")
          public float spacing(MotionEvent event) {
              float x = event.getX(0) - event.getX(1);
              float y = event.getY(0) - event.getY(1);
              return FloatMath.sqrt(x * x + y * y);
          }
  
          public void midPoint(PointF point, MotionEvent event) {
              float x = event.getX(0) + event.getX(1);
              float y = event.getY(0) + event.getY(1);
              point.set(x / 2, y / 2);
          }
      });
  </code></pre>