Code example for ScaleGestureDetector

Methods: getScaleFactor

    private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
        public boolean onScale(ScaleGestureDetector detector) {
            return true; 
    public void onSensorChanged(SensorEvent event) {
        // we received a sensor event. it is a good practice to check 
        // that we received the proper event 
        if (mUseSensor) {
            if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
                // convert the rotation-vector to a 4x4 matrix. the matrix 
                // is interpreted by Open GL as the inverse of the 
                // rotation-vector, which is what we want. 
                        mRotationMatrix , event.values);