@Override public void onWindowFocusChanged(boolean hasFocus) { if (hasFocus) { startAnimation(); } else { stopAnimation(); } super.onWindowFocusChanged(hasFocus); }
@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(); } }