title: android animation through button
body: <p>I am creating a dash board application. This is what it looks like:<br>
  <img src="https://i.stack.imgur.com/sX7co.png" alt="enter image description here"> </p>
  
  <p>Now I will explain to you how it is working. When I am clicking the "UP" button the red hand moves up and stay in the 30. The "DOWN" button is used for down the hand from 30 to 0. The BUTTON5 is used for moving the hand from 0 (starting position) to 5. When I am clicking BUTTON10 it means it will move from 5 to 10. BUTTON-5 is used for down the hand from 10 to 5 and BUTTON0 is used for down the hand from 5 to 0.</p>
  
  <p>This is my code:</p>
  
  <pre><code>import android.app.Activity;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.graphics.Matrix;
  import android.graphics.drawable.BitmapDrawable;
  import android.os.Bundle;
  import android.view.MotionEvent;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.view.animation.AccelerateInterpolator;
  import android.view.animation.Animation;
  import android.view.animation.AnimationUtils;
  import android.widget.Button;
  import android.widget.ImageView;
  
  public class dash1 extends Activity {
      ImageView img, img1;
      Animation an, an1, an2, an3, an4, an5;
      Button bt, bt2, bt3, bt4, bt5, bt6;
  
      /** Called when the activity is first created. */
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          img = (ImageView) findViewById(R.id.ImageView01);
          final Bitmap bmp = BitmapFactory.decodeResource(getResources(),
                  R.drawable.minute);
          final int w = bmp.getWidth();
          final int h = bmp.getHeight();
          final Matrix mat = new Matrix();
          mat.postRotate(245);
          Bitmap rtd = Bitmap.createBitmap(bmp, 0, 0, w, h, mat, true);
          BitmapDrawable bmd = new BitmapDrawable(rtd);
          img.setImageDrawable(bmd);
          an = AnimationUtils.loadAnimation(this, R.anim.anim);
          an1 = AnimationUtils.loadAnimation(this, R.anim.anim1);
          an2 = AnimationUtils.loadAnimation(this, R.anim.anim2);
          an3 = AnimationUtils.loadAnimation(this, R.anim.anim3);
          an4 = AnimationUtils.loadAnimation(this, R.anim.anim4);
          an5 = AnimationUtils.loadAnimation(this, R.anim.anim5);
          bt = (Button) findViewById(R.id.Button01);
          bt2 = (Button) findViewById(R.id.Button02);
          bt3 = (Button) findViewById(R.id.Button03);
          bt4 = (Button) findViewById(R.id.Button04);
          bt5 = (Button) findViewById(R.id.Button05);
          bt6 = (Button) findViewById(R.id.Button06);
          bt.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  an.setFillAfter(true);
                  img.startAnimation(an);
  
              }
          });
  
          bt2.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  img.startAnimation(an1);
              }
          });
          bt3.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  an2.setFillAfter(true);
                  img.startAnimation(an2);
  
              }
          });
          bt4.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  an3.setFillAfter(true);
                  img.startAnimation(an3);
              }
          });
          bt5.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
  
                  an2.setFillAfter(true);
                  img.startAnimation(an4);
              }
          });
          bt6.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  an5.setFillAfter(true);
                  img.startAnimation(an5);
              }
          });
      }
  }
  </code></pre>
  
  <p>Now I want to add a button "+" instead of button5 and button10 (for increment) and "-" for the button-5 and 0. How can I do the increment by a single button. I don't know how to do this. Here for rotating I am using animation. This is the xml code for rotation. Anybody know how to do this means just tell me.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
      android:shareInterpolator="false"&gt;
      &lt;rotate android:toYScale="0.0" 
          android:pivotX="50%" 
          android:pivotY="50%" 
          android:duration="3599" 
          android:fromDegrees="0" 
          android:toDegrees="205"&gt;
       &lt;/rotate&gt;
  &lt;/set&gt;
  </code></pre>