Пример #1
0
 @Override
 public void onWindowFocusChanged(boolean hasFocus) {
   if (hasFocus) {
     startAnimation();
   } else {
     stopAnimation();
   }
   super.onWindowFocusChanged(hasFocus);
 }
Пример #2
0
 @Override
 public void onWindowFocusChanged(boolean hasFocus) {
   super.onWindowFocusChanged(hasFocus);
   if (hasFocus) {
     iv = (ImageView) findViewById(R.id.iv);
     iv.setBackgroundResource(R.drawable.my_progress_animation_drawable);
     animationDrawable = (AnimationDrawable) iv.getBackground();
     animationDrawable.start();
   }
 }