Q:

How can I rotate an Image on an axis when clicked in android?

I want something like this. When someone clicks the button it should rotate it in 90 degrees perfectly.

A:

First Rotate your bitmap to 90 degree and then assign it again to your imageView.
Try following code:
In your onCreate Method,
myImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            myImageView.setImageBitmap(RotateBitmap(((BitmapDrawable)myImageView.getDrawable()).getBitmap() , 90));
        }
    });

And Create a Method below.
public static Bitmap RotateBitmap(Bitmap source, float angle) {
        Matrix matrix = new Matrix();
        matrix.postRotate(angle);
        return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true);
}

