March 2013
Beginner to intermediate
580 pages
16h 11m
English
Adding a user interface to allow creation of new runs is easy using an options/action bar menu item, just as you did with CriminalIntent. Start by creating a resource for the menu.
Listing 34.15 Options menu for the run list (run_list_options.xml)
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/menu_item_new_run"
android:showAsAction="always"
android:icon="@android:drawable/ic_menu_add"
android:title="@string/new_run"/>
</menu>
This menu refers to a string, so add that to the strings file.
Listing 34.16 Adding a New Run string (strings.xml)
<string name="stop">Stop</string> <string name="gps_enabled">GPS Enabled</string> <string name="gps_disabled">GPS ...
Read now
Unlock full access