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" /> ...
Get Xamarin Mobile Application Development for Android - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.