Weird thing in Android 4.4.2 - Problem
I set a setAnimation as ImageResource to an ImageView when I click it.
((ImageView) v).setImageResource(R.drawable.set_animation);
Well it shouldn't start because in Android 4.0 ; 4.1; 4.2 and 4.3 I have to call
(AnimationDrawable)((ImageView) v).getDrawable().start();
So in Android 4.4.2 as soon as I set the ImageResource the animation starts.
Someone can tell why this happens and how can I stop the animation from starting? Thak you in advance.
Try changing your implementation to this and see if you have a better experience:
// Load the ImageView that will host the animation and
// set its background to our AnimationDrawable XML resource.
ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image);
img.setBackgroundResource(R.drawable.spin_animation);
// Get the background, which has been compiled to an AnimationDrawable object.
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
// Start the animation (looped playback by default).
frameAnimation.start();
found it here: http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html