Adding the save and delete actions
Using POIDetailActivity
, users can choose to save or delete POIs. The same Save button works for two scenarios: when the POI details are passed from POIListActivity
, it will update the POI details; otherwise, it will create a new record.
We need a way to accomplish these tasks from the user interface. Let's use ActionBar
and add two actions: Save
and Delete
. Create a new file named POIDetailMenu.xml
under the Resources/menu
directory to declare the menu layout. The following listing shows what is needed for POIDetailMenu.xml
:
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/actionSave" android:icon="@drawable/ic_save" android:title="Save" android:showAsAction="ifRoom" /> <item android:id="@+id/actionDelete" android:icon="@drawable/ic_delete" android:title="Delete" android:showAsAction="ifRoom" /> </menu>
Note that each menu item has an icon specified. These icons...