private void initialiseImage() {
    final SubsamplingScaleImageView imageView =
        (SubsamplingScaleImageView) findViewById(id.imageView);
    final GestureDetector gestureDetector =
        new GestureDetector(
            this,
            new GestureDetector.SimpleOnGestureListener() {
              @Override
              public boolean onSingleTapConfirmed(MotionEvent e) {
                if (imageView.isReady()) {
                  PointF sCoord = imageView.viewToSourceCoord(e.getX(), e.getY());
                  Toast.makeText(
                          getApplicationContext(),
                          "Single tap: " + ((int) sCoord.x) + ", " + ((int) sCoord.y),
                          Toast.LENGTH_SHORT)
                      .show();
                } else {
                  Toast.makeText(
                          getApplicationContext(),
                          "Single tap: Image not ready",
                          Toast.LENGTH_SHORT)
                      .show();
                }
                return true;
              }

              @Override
              public void onLongPress(MotionEvent e) {
                if (imageView.isReady()) {
                  PointF sCoord = imageView.viewToSourceCoord(e.getX(), e.getY());
                  Toast.makeText(
                          getApplicationContext(),
                          "Long press: " + ((int) sCoord.x) + ", " + ((int) sCoord.y),
                          Toast.LENGTH_SHORT)
                      .show();
                } else {
                  Toast.makeText(
                          getApplicationContext(),
                          "Long press: Image not ready",
                          Toast.LENGTH_SHORT)
                      .show();
                }
              }

              @Override
              public boolean onDoubleTap(MotionEvent e) {
                if (imageView.isReady()) {
                  PointF sCoord = imageView.viewToSourceCoord(e.getX(), e.getY());
                  Toast.makeText(
                          getApplicationContext(),
                          "Double tap: " + ((int) sCoord.x) + ", " + ((int) sCoord.y),
                          Toast.LENGTH_SHORT)
                      .show();
                } else {
                  Toast.makeText(
                          getApplicationContext(),
                          "Double tap: Image not ready",
                          Toast.LENGTH_SHORT)
                      .show();
                }
                return true;
              }
            });

    imageView.setImage(ImageSource.asset("squirrel.jpg"));
    imageView.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            return gestureDetector.onTouchEvent(motionEvent);
          }
        });
  }
 private void initialiseImage() {
   SubsamplingScaleImageView imageView = (SubsamplingScaleImageView) findViewById(id.imageView);
   imageView.setImage(ImageSource.asset("squirrel.jpg"));
 }