Book Image

Xamarin Mobile Application Development for Android, Second Edition

Book Image

Xamarin Mobile Application Development for Android, Second Edition

Overview of this book

Table of Contents (18 chapters)
Xamarin Mobile Application Development for Android Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Defining the menu XML file


Actions can be defined in a menu XML file that resides in the Resources/menu folder, or it can be created programmatically using API calls. We will define the New and Refresh actions in an XML file named POIListViewMenu.xml.

To create POIListViewMenu.xml, perform the following steps:

  1. Select the Resources folder in POIApp, right-click on it, and navigate to Add | New Folder.

  2. Name the folder menu.

  3. Select the menu folder, right-click on it, and navigate to Add | New File.

  4. Navigate to XML | Empty XML file, enter POIListViewMenu.xml for the name, and click on New.

You now need to fill in the definitions for the two actions we identified. Unfortunately, Xamarin Studio does not contain a template for menu XML files, so you have to hunt the format down from the Android documentation or online examples. The following code contains definitions for actionNew and actionRefresh:

 <menu xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:id="@+id...