title: Unsmooth, lagging animation in android
body: <p>I have used animation on an activity in my game where user sees his score in form of stars(maximum score gets 3 stars). I have used animation on each of the stars(using <strong>startAnimation()</strong> method). The golden stars gets placed on the blank grey colored stars with translation, scale and alpha animation(I have used set animation).
  But whenever that score activity starts the animation gets displayed with jerkiness/lag/unsmoothness.
  Whats the <strong>solution to make that animation smooth and timely</strong>?</p>
  
  <p>Following is the java code to dislplay 3 out of 3 stars</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) 
      {
           ............
          Myanim1 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.alpha_scale_left);
          Myanim2= AnimationUtils.loadAnimation(getApplicationContext(), R.anim.aplha_scale_mid);
          Myanim3= AnimationUtils.loadAnimation(getApplicationContext(), R.anim.alpha_scale_right);
            ......}
  
  if(pattern_Score&gt;targetScore*90/100)
              {
                  mCountDownTimer = new CountDownTimer(1000,100) {
  
                  @Override
                  public void onTick(long millisUntilFinished) {
                      starIv1.setImageResource(R.drawable.star_gray);
                  }
  
                  @Override
                  public void onFinish() {
                      starIv1.startAnimation(Myanim1);
                      starIv1.setImageResource(R.drawable.star);
                      Toast.makeText(getApplicationContext(), "timer1 stopped", Toast.LENGTH_SHORT).show();
                  }
              };
              mCountDownTimer.start();
              starIv1.clearAnimation();
  
  
                  mCountDownTimer1=new CountDownTimer(2000,100) {
  
                      @Override
                      public void onTick(long millisUntilFinished) { 
                          starIv2.setImageResource(R.drawable.star_gray);
                      }
  
                      @Override
                      public void onFinish() {
                          //starIv2.clearAnimation(); 
                          starIv2.startAnimation(Myanim2);
                          starIv2.setImageResource(R.drawable.star);
                      }
                  };
                  mCountDownTimer1.start();
                  starIv2.clearAnimation();
  
                  mCountDownTimer2=new CountDownTimer(3000,100) {
  
                      @Override
                      public void onTick(long millisUntilFinished) { 
                          starIv3.setImageResource(R.drawable.star_gray);
                      }
  
                      @Override
                      public void onFinish() {
                          //starIv3.clearAnimation(); 
                          starIv3.startAnimation(Myanim3);
                          starIv3.setImageResource(R.drawable.star);
                      }
                  };
                  mCountDownTimer2.start();
                  starIv3.clearAnimation();....}
  </code></pre>
  
  <p>alpha_scale_left.xml(animation on left star)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;translate android:fromYDelta="-100%"
             android:fromXDelta="-20%" 
             android:toYDelta="0"
             android:toXDelta="0" 
             android:duration="600"/&gt;
  &lt;scale 
          android:fromXScale="3000%"
          android:fromYScale="3000%"
          android:toXScale="1"
          android:toYScale="1"
          android:pivotX="50%"
          android:pivotY="50%"
          android:duration="900"
      /&gt;
  &lt;alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="600" /&gt;
  
  
  &lt;/set&gt;
  </code></pre>
  
  <p>alpha_scale_mid.xml(animation on middle star)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;translate android:fromYDelta="-100%"
             android:fromXDelta="-5%" 
             android:toYDelta="0"
             android:toXDelta="0" 
             android:duration="600"/&gt;
  &lt;scale 
          android:fromXScale="3000%"
          android:fromYScale="3000%"
          android:toXScale="1"
          android:toYScale="1"
          android:pivotX="50%"
          android:pivotY="0%"
          android:duration="600"
      /&gt;
  &lt;alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="600" /&gt;
  
  &lt;/set&gt;
  </code></pre>
  
  <p>alpha_scale_right.xml(animation on right star)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;translate android:fromYDelta="-100%"
             android:fromXDelta="5%" 
             android:toYDelta="0"
             android:toXDelta="0" 
             android:duration="600"/&gt;
  &lt;scale 
          android:fromXScale="3000%"
          android:fromYScale="3000%"
          android:toXScale="1"
          android:toYScale="1"
          android:pivotX="50%"
          android:pivotY="0%"
          android:duration="600"
      /&gt;
  &lt;alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="600" /&gt;
  
  &lt;/set&gt;
  </code></pre>