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

Adding navigation to POIDetailActivity


There are two scenarios where we need to navigate from POIListActivity to POIDetailActivity, either by selecting the New action on the navigation bar or by selecting any of the POIs from the list. The main difference between the two scenarios is that when selecting an existing POI from the list, we will have to pass the details of the selected POI to the POIDetailActivity so that the user can edit and update the POI record. When creating a new POI, we don't pass any data. Let's first choose the simplest one, and add the navigation to the New action.

The Activity class provides a method named StartActivity() that is used to start a new activity. The StartActivity() method can also be used in a number of different scenarios. In case of the New action, we will be using it in its most basic form. For starting an activity, all that we need to do is to invoke StartActivity() by passing the type for the activity we want to start.

The following code snippet demonstrates...