Code example for ScaleGestureDetector

0
        backgroundImage.setBounds(0, 0, backgroundImage.getIntrinsicWidth(), backgroundImage.getIntrinsicHeight());
 
    } 
 
    private void initializeScaleDetector(Context context) {
        mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    } 
 
    private void initializeVariables() { 
        touchPoints = new ArrayList<PointF>();
        firstIterationMultitouch = true;
    } 
 
    @Override 
    public boolean onTouchEvent(MotionEvent ev) {
 
        activateScaleDetector(ev);
 
        final int action = ev.getAction();
 
        switch (action & MotionEvent.ACTION_MASK) {