Image view rotation on ACTION_MOVE
<p>I'm able to rotate image view on ACTION_DOWN.</p>

<p>but its not working for ACTION_MOVE &amp; ACTION_UP.</p>

<pre><code>public class RotateImage extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Rotate rotate;
        rotate = new Rotate(this);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
            requestWindowFeature(Window.FEATURE_NO_TITLE);

        setContentView(rotate);
    }
}

public class Rotate extends ImageView {
    Paint paint;
    int direction = 0;
    private float x;
    private float y;
    int degree = 0;
    float a, b, c;
    private float centerX ;
    private float centerY ;
    private float newX ;
    private float newY ;

    public Rotate(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
        paint = new Paint();
        paint.setColor(Color.WHITE);
        paint.setStrokeWidth(2);
        paint.setStyle(Style.STROKE);

        this.setImageResource(R.drawable.direction1);
    }

    @Override
    protected void onDraw(Canvas canvas) {

        int height = this.getHeight();
        int width = this.getWidth();
        centerX = width/2;
        centerY = height/2;
        canvas.rotate(direction, width / 2, height / 2);
        super.onDraw(canvas);

    }

    public void setDirection(int direction) {
        this.direction = direction;
        this.invalidate();
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        System.out.println("now i'm in BEFORE calling MotionEvent.ACTION_MOVE ");

        if (event.getAction() == MotionEvent.ACTION_DOWN) {

            x = event.getX();
            y = event.getY();

            newX =  centerX-x;
            newY = centerY-y;

            updateRotation( newX,  newY); 

            }
            else if (event.getAction() == MotionEvent.ACTION_MOVE) {

                x = event.getX();
                y = event.getY();

                newX =  centerX-x;
                newY = centerY-y;

                updateRotation( newX,  newY); 

                }
            else if (event.getAction() == MotionEvent.ACTION_UP) {

                    x = event.getX();
                    y = event.getY();

                    newX =  centerX-x;
                    newY = centerY-y;

                    updateRotation( newX,  newY); 

                    }
        return super.onTouchEvent(event);
    }

    private void updateRotation(float newX2, float newY2) {
        // TODO Auto-generated method stub

        degree = (int)Math.toDegrees(Math.atan2(newY, newX))-90;

        setDirection(degree);
    }

}
</code></pre>

<p>any suggestion would be appropriated</p>
