CHAPTER 10: Android Animation: Making Your UI Designs Move 385
Using .setBackground( ): Upgrade App to SDK V16
Just to be thorough, I wanted to include a screen shot showing you the AndroidManifest.xml file,
with the new Minimum SDK Version parameter set to API Level 16, which is shown highlighted in
Figure 10-25. This will allow you to use the .setBackground(null) to remove any background image
from the ImageView object, and later you will use a .setAnimation(null) to remove the procedural
animation data from the ImageView as well.
Figure 10-25. Upgrading the android:minSdkVersion parameter to 16 to be able to use the .setBackground(null)
As you can see in Figure 10-26, your code for the imageButtonTwo event handler structure is now
error-free, and your Java programming logic that performs the three major “moves” that need to be
done regarding your animation asset are in place. In pseudo-code, the three things that we will need
to do for each ImageButton are:
Set the Source (foreground) Image Plate Asset by using the .setImageResource() method call
Set the Background Image Plate Asset by using .setBackgroundResource() or remove it using
.setBackground(null)
Set the Animation Asset by using the .startAnimation() method call or remove it using the
.setAnimation(null)