Code example for ScaleGestureDetector

Methods: onTouchEvent

0
		canvas.restore();
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
		scaleGestureDetector.onTouchEvent(event);
		invalidate();
		return true; 
	} 
 
	private class ScaleListener extends 
			ScaleGestureDetector.SimpleOnScaleGestureListener {
		@Override 
		public boolean onScale(ScaleGestureDetector detector) {
			scaleFactor *= detector.getScaleFactor();
 
			// Don't let the object get too small or too large. 
			scaleFactor = Math.max(0.1f, Math.min(scaleFactor, 5.0f));
 
			invalidate();
			return true;