Your final step in the process to create the test harness is to update the application's AndroidManifest.xml file. This file, which is automatically created for you when you create a new project, is available in your project's root directory.
This is the place where you register the Activity class (such as SampleMenusActivity) and where you specify a title for the activity. We called this activity "Sample Menus Application," as shown in Figure 5-2. See this entry highlighted in Listing 5-13.
Listing 5-13. The AndroidManifest.xml File for the Test Harness <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="your-package-name-goes-here " android:versionCode="1" android:versionName="1.0.0"> <application android:icon="@drawable/icon" android:label="Sample Menus"> <activity android:name=".SampleMenusActivity"
android:label="Sample Menus Application"> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
Using the code we've provided, you should be able to quickly construct this test harness for experimenting with menus. We showed you how to create a simple activity initialized with a text view, and then how to populate and respond to menus. Most menus follow this basic yet functional pattern. You can use Figure 5-2 as a guide for what kind of UI to expect when you are done with the exercise. But as we pointed out, what you see might not exactly match the figure because we haven't yet shown you how to add the icon menus. Your UI might differ even after you add the icon menus, because your images might differ from the images we used.
Was this article helpful?