CHAPTER 14: Android Content Providers: Providing Data to Applications 521
Next, right-click on the main.xml Menu object definition file in the /res/menu folder and add a
contact_galaxy MenuItem object. To do this, you use an
your other menu items, as shown in Figure 14-8.
Figure 14-7. Add a
Figure 14-8. Add a MenuItem object using
Adding a Menu Intent in the MainActivity Class
Now that your MenuItem object is defined using XML, you can reference it in your
onOptionsItemSelected( ) event handling structure in your MainActivity.java class. You will do this
so that your users can switch over to the ContactGalaxy Activity subclass. Add a case statement for
R.id.contact_galaxy and create a new Intent object named dataIntent using the Java new keyword.