584 CHAPTER 15: Developing for Android Wearable Devices
The XML mark-up for the
following markup:
<FrameLayout xmlns:android=http://schemas.android.com/apk/res/android
xmlns:tools="http://schemas.android.com/tools"
tools:context="absolute.beginners.earthtime. MainActivity"
android:background="@drawable/earthtimebackground" android:id="@+id/earthTime"
android:layout_width="match_parent" android:layout_height="match_parent" >
Now your EarthTime application has a user interface and composited imagery just like an Android
app should!
Use the Run As ➤ Android Application menu sequence to test the final user interface design.
Depending on how you had your AVD scale to real world size set, the application should look similar
to Figure 15-40.
Figure 15-40. Test the new background image with Scale to Real Size off (left) and Scale to Real Size on (right)
Now you are ready to add the Java code that will instantiate your UI elements and make them interactive.
You will do this using the same Java object declarations, instantiations, and event handling
structures you have learned about during the course of this book.
EarthTime Interactive: Adding Event Handling
The first thing to do is to declare an AnalogClock object named planetClock, as shown in
Figure 15-41, and then mouse over the wavy red error highlight to have Eclipse import the
AnalogClock class for you to utilize.