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

Creating the POI ListView layout


When we created the POIApp project, a default layout and activity was created for us. Rather than deleting these, let's give them more appropriate names and remove unnecessary content as follows:

  1. Select main.axml in Resources | Layout.

  2. Right-click on it, select Rename, and enter the name as POIList.axml.

  3. Double-click on it to open POIList.axml.

  4. Click on the Hello World button and then click on the the Delete button.

  5. Select MainActivity.cs and rename it as POIListActivity.cs.

  6. Double-click on it to open POILIstActivity.cs.

  7. Rename the class inside as POIListActivity.

  8. Change the layout ID referenced in the SetContentView() API call to Resources.Layout.POIList.

  9. Remove the code related to the Hello World button that we removed from the layout. Your class should now look like the following code:

    [Activity (Label = "POIs", MainLauncher = true)]
    public class POIListActivity : Activity
    {
      protected override void OnCreate (Bundle bundle)
      {
        base.OnCreate (bundle);
    
       ...