Book Image

Xamarin Mobile Application Development for Android

By : Mark Reynolds
Book Image

Xamarin Mobile Application Development for Android

By: Mark Reynolds

Overview of this book

<p>Technology trends come and go, but few have generated the excitement, momentum, or long-term impact that mobile computing has. Mobile computing impacts people’s lives at work and at home on a daily basis. Many companies and individual developers are looking to become a part of the movement but are unsure how to best utilize their existing skills and assets. The Xamarin suite of products provides new opportunities to those who already have a significant investment in C# development skills and .NET code bases, and would like to enter into this new, exciting world.</p> <p>This example-oriented guide provides a practical approach to quickly learning the fundamentals of Android app development using C# and Xamarin.Android. It will lead the readers through building an Android app step-by-step with steadily increasing complexity.</p> <p>This book begins with an overview of the Android and Xamarin platforms to provide you with a solid understanding of the environment you will be working in. You will then be gradually walked through building and testing an Android app using C# and the Xamarin.Android product. You will learn the basics of interacting with some of the more interesting aspects of Android devices including location services, the camera, and maps. You will also be given the opportunity to work with three different layout managers to gain an understanding of the various options available for arranging controls and content. The book ends with a discussion on the final steps involved in preparing apps for deployment to the various Android app stores.</p> <p>In a relatively short period of time, developers familiar with C# and rich client technologies such as WPF and Silverlight will be effectively developing, testing, and delivering Android apps.</p>
Table of Contents (16 chapters)
Xamarin Mobile Application Development for Android
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding Save and Delete actions


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...