Using POIDetailActivity
, users can choose to save new or existing POIs, or delete existing POIs. We need a way to accomplish these tasks from the user interface. We will use ActionBar
again and add two actions, Save
and Delete
.
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 can be found in the [assets location]\drawable
folder.
The OnCreateOptionsMenu()
and OnOptionsItemSelected()
methods are also very similar to what we created in the previous chapter. The following code snippet is the modified version:
public override bool OnCreateOptionsMenu...