Building and Running the Activity

To build the activity, either use your IDE's built-in Android packaging tool, or run ant in the base directory of your project. Then, to run the activity do the following:

1. Launch the emulator (e.g., run tools/emulator from your Android SDK installation), as shown in Figure 4-1.

Figure 4-1. The Android home screen

2. Install the package (e.g., run tools/adb install /path/to/this/example/bin/Now.apk from your Android SDK installation).

3. View the list of installed applications in the emulator and find the Now application (see Figure 4-2).

Figure 4-2. The Android application "launcher" 4. Open that application.

You should see an activity screen like the one shown in Figure 4-3. [

Tue Aug 19 21:59:51 GMTtOQ:00 2008

Figure 4-3. The Now demonstration activity

Clicking the button—in other words, clicking pretty much anywhere on the phone's screen—will update the time shown in the button's label.

Note that the label is centered horizontally and vertically, as those are the default styles applied to button captions. We can control that formatting, which Chapter 6 covers.

After you are done gazing at the awesomeness of Advanced Push-Button Technology, you can click the back button on the emulator to return to the launcher.

0 0

Post a comment