package com.android_examples.androidanimations_android_examplescom;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;

public class RotateActivity extends AppCompatActivity {

    Button button ;
    ImageView imageView;
    Animation animation ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rotate);

        button = (Button)findViewById(R.id.buttonRotate_Activity);
        imageView = (ImageView)findViewById(R.id.imageViewRotate);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                animation = AnimationUtils.loadAnimation(RotateActivity.this,
                        R.anim.animation_rotate);

                imageView.startAnimation(animation);

            }
        });
    }
}
