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

Setting menus in OnCreateOptionsMenu()


The OnCreateOptionsMenu() method is called to give an opportunity to the Activity parameter to define actions for the ActionBar. The Activity class provides a MenuInflater method, which reads the XML definition file and places the action defined on the ActionBar. The following code shows the implementation from the code bundle:

public override bool OnCreateOptionsMenu(IMenu menu)
{
    MenuInflater.Inflate(Resource.Menu.POIListViewMenu, menu);
    return base.OnCreateOptionsMenu(menu);
}