Creating menu and string resources
Our app's menus and localizable text are described in XML files. Identifiers in these resource files are referenced by Java code, as we will see later.
Note
For details about Android app resources, see the official documentation at http://developer.android.com/guide/topics/resources/index.html.
First, let's edit res/menu/activity_camera.xml
so that it has the following implementation, describing the menu items for CameraActivity
:
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/menu_next_camera" android:orderInCategory="100" android:showAsAction="ifRoom|withText" android:title="@string/menu_next_camera"/> <item android:id="@+id/menu_take_photo" android:orderInCategory="100" android:showAsAction="always|withText" android:title="@string/menu_take_photo"/> </menu>
Note that we use the android:showAsAction
attribute to make menu items appear in the app's top bar...