title: Rotating image in Android with a button
body: <p>I have a image with a few buttons on the view.   One of the buttons moves the image down.  It moves the image down by adding 1 px to the top margin.  Here is the code: </p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Button button = (Button) findViewById(R.id.button1);
          final ImageView image = (ImageView) findViewById(R.id.image1);
          button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  ((ViewGroup.MarginLayoutParams) image.getLayoutParams()).topMargin += 1;
                  image.requestLayout();
              }
          });
      }
  </code></pre>
  
  <p>Now, i want to be able to rotate the image.  Just like the code i have  now,  I want a button, when the button is pressed the image will rotate.  But how can i do this?  </p>