When the user makes an incorrect choice, the app shakes the flag by applying an Animation (package android.view.animation
) to the ImageView
. We use AnimationUtils static
method loadAnimation to load the animation from an XML file that specifies the animation’s options. We also specify the number of times the animation should repeat with Animation
method setRepeatCount and perform the animation by calling View
method startAnimation (with the Animation
as an argument) on the ImageView
.