Xamarin Mobile Application Development for Android


Xamarin Mobile Application Development for Android
eBook: $20.99
Formats: PDF, PacktLib, ePub and Mobi formats
$17.84
save 15%!
Print + free eBook + free PacktLib access to the book: $55.98    Print cover: $34.99
$34.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Gain an understanding of both the Android and Xamarin platforms
  • Build a working multi-view Android app incrementally throughout the book
  • Work with device capabilities such as location sensors and the camera

Book Details

Language : English
Paperback : 168 pages [ 235mm x 191mm ]
Release Date : January 2014
ISBN : 1783559160
ISBN 13 : 9781783559169
Author(s) : Mark Reynolds
Topics and Technologies : All Books, Mobile Application Development, Other


Table of Contents

Preface
Chapter 1: The Anatomy of an Android App
Chapter 2: Xamarin.Android Architecture
Chapter 3: Creating the Points of Interest App
Chapter 4: Creating a Data Storage Mechanism
Chapter 5: Adding a List View
Chapter 6: Adding a Detail View
Chapter 7: Making POIApp Location Aware
Chapter 8: Adding Camera App Integration
Chapter 9: Deploying Your App
Index
  • Chapter 1: The Anatomy of an Android App
    • The Android platform
      • Linux
      • Native libraries
      • The Android runtime
      • The Application Framework
      • Applications
        • The Android packages (.apk)
        • The application manifest
      • Versions of Android
    • The Android applications
      • Activities
        • The life cycle of an activity
        • The states of an activity
        • The events of an activity
      • Services
      • Content providers
      • Broadcast receivers
      • Views and ViewGroups
        • Declarative versus programmatic View creation
        • User interface widgets
        • Common layouts
        • Adapter layouts
      • XML layout files
        • Element and attribute names
        • IDs
        • Using XML layouts from activities
      • Intents
      • Resources
        • The R.java file
    • Summary
  • Chapter 2: Xamarin.Android Architecture
    • Why Xamarin.Android?
    • What is Mono?
    • Mono and Dalvik side by side
      • The Java Native Interface
        • Peer objects
      • Xamarin.Android application packaging
    • The Android bindings design
      • Design principles
      • C# properties
      • Delegates
      • Constants to enumerations
    • Development environments
      • Xamarin Studio
      • Xamarin for Visual Studio
      • IDE comparison
      • Compatibility
    • Summary
  • Chapter 3: Creating the Points of Interest App
    • The sample app
    • Installing Xamarin.Android
    • Creating the app
      • Xamarin Studio IDE
      • The Project Options View
        • Setting the target framework
        • Setting the app icon and package name
      • The initial activity
      • Running and debugging the app
      • Creating and customizing emulators
      • Using the x86 emulator
      • Debugging with an Android device
        • Enabling USB debugging
        • Installing a USB driver
        • Running apps on a device
    • Behind the scenes
      • Peer object
      • The AndroidManifest.xml file
    • Summary
  • Chapter 4: Creating a Data Storage Mechanism
    • Creating the Point of Interest entity class
    • Creating the POI storage interface
    • Implementing the POI storage services
      • Using Xamarin.Android NUnitLite
        • Setting up for tests
        • Creating the test methods
        • Executing the tests
      • Json.NET
        • Downloading Json.NET
      • Implementing and testing the POIJsonService methods
        • Implementing caching
        • Implementing SavePOI()
        • Implementing GetPOI()
        • Implementing DeletePOI()
    • Summary
  • Chapter 5: Adding a List View
    • Creating the POI ListView layout
      • Adding a RelativeLayout view group
      • Adding an ImageView widget
      • Adding a LinearLayout widget
      • Adding the name and address TextView classes
      • Adding the Distance TextView
    • Populating the ListView item
      • Shared instance of IPOIDataService
        • Permissions
      • Creating POIListViewAdapter
      • Implementing a constructor
      • Implementing Count { get; }
      • Implementing GetItemId()
      • Implementing the index getter method
      • Implementing GetView()
        • Reusing row Views
        • Populating row Views
      • Hooking up POIListViewAdapter
    • Adding actions to ActionBar
      • Defining the menu .xml file
      • Setting menus in OnCreateOptionsMenu
      • Handling selection in OnOptionsItemSelected()
    • Configuring an SD card for the emulator
    • Running POIApp
    • Android Device Monitor
    • Handling row clicks
    • Summary
  • Chapter 6: Adding a Detail View
    • Creating the POIDetail layout
      • Working with InputType
      • Creating POIDetailActivity
      • Binding variables to controls
    • Adding navigation to POIDetailActivity
      • Navigating on new action
      • Navigating on POI Click
      • Receiving data in POIDetailActivity
      • Populating user interface widgets
    • Adding Save and Delete actions
      • Disabling the Delete action
      • Creating SavePOI()
      • Creating DeletePOI()
    • Adding validation
      • Using the EditText.Error property
    • Adding a Delete confirmation prompt
    • Toasting success
    • Refreshing POIListActivity
    • Wrapping up
    • Summary
  • Chapter 7: Making POIApp Location Aware
    • Location services
      • Setting app permissions
      • Configuring the emulator
      • Obtaining an instance of LocationManager
      • Requesting location change notifications
        • Implementing ILocationListener
      • Adding location services to POIApp
        • Adding location services to POIListActivity
        • Adding location services to POIDetailActivity
        • Getting an address for a location
        • Keeping the user informed
        • Dealing with configuration changes
    • Adding map integration
      • Navigating to the map app
        • Checking for registered map apps
    • Summary
  • Permissions and Features
  • Configuring the Emulator
  • Extending the data service
    • Defining GetImageFilename()
    • Implementing GetImageFilename()
    • Updating DeletePOI()
  • Capturing an image from POIDetailActivity
    • Adding UI elements
    • Creating the intent
    • Checking for registered camera apps
    • Providing additional information with the intent
      • Providing a filename and location
      • Providing size limit
    • Starting the intent
      • Completing the NewPhotoClicked() method
    • Processing the results of the intent
  • Displaying existing images in POIDetailActivity
  • Displaying POI images in POIListActivity
  • Summary
  • Chapter 9: Deploying Your App
    • App distribution options
    • Preparing for a release APK
      • Disabling debug
        • AndroidManifest.xml
        • AssemblyInfo.cs
      • Linking
        • Linking options
        • Side effects of linking
      • Selecting supported ABIs
    • Publishing a signed APK
      • Keystores
      • Publishing from Xamarin.Android
      • Republishing
    • Summary

Mark Reynolds

Mark Reynolds is a software enthusiast who has worked in the industry for nearly 30 years. He began his career with Electronic Data Systems, building and supporting systems for the manufacturing sector. Over the years, he has worked with companies ranging in size from startups to Fortune 500 across a diverse set of industries including manufacturing, entertainment, financial services, government, and telecom. In 1993, Mark started a consulting practice focused on delivering training and mentoring services in the areas of software architecture, design, and implementation. With the rise of mobile computing, Mark has returned to what he loves the most, designing, developing, and delivering software solutions, now focusing in the mobile computing space. He continues his private consulting practice based in Allen, TX, where he also resides with his wife and son.

Mark works as an independent consultant through his own private consulting practice (RSEG) based in Allen, TX, a community located north of Dallas. You can find out more about the services he offers from his website, rseg.net.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 4 submitted: last submission 20 Mar 2014

Errata type: Code | Page number: 93

poiDetailIntent.PutExtra ("poiId", poi.Id);

should be

poiDetailIntent.PutExtra ( poiId, poi.Id.Value)

Errata type: Code | Page number: 85

PointOfInterest poi = POIDataService.GetPOI ((int)e.Id);

should be

PointOfInterest poi = POIData.Service.GetPOI ((int)e.Id);

Errata type: Code | Page number: 131

RESULT_OK

REQUEST_CANCELED

REQUEST_FIRST_USER

should be

RESULT.OK

REQUEST.CANCELED

REQUEST.FIRSTUSER

Errata type: Code | Page number: 132

if (resultCode == RESULT_OK) {

should be

if (resultCode == RESULT.OK) {

Errata type: Code | Page number: 132

Notice that when  resultCode is RESULT_OK, we load the photo that was captured into a Bitmap object and then set the image for _poiImageView. This causes the image to be displayed at the bottom of the POIDetail layout. If resultCode is not RESULT_OK, we display a toast message to the user indicating that the action was cancelled.

should be

Notice that when  resultCode is RESULT.OK, we load the photo that was captured into a Bitmap object and then set the image for _poiImageView. This causes the image to be displayed at the bottom of the POIDetail layout. If resultCode is not RESULT.OK, we display a toast message to the user indicating that the action was cancelled.

Errata type: Code | Page number: 64

File.Delete (GetFilename (poi.Id));

should be

File.Delete (GetFilename (poi.Id.Value));

 

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Xamarin Mobile Application Development for Android +    Mastering Apache Cassandra =
50% Off
the second eBook
Price for both: £21.44

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Build a multi-view Android application with navigation
  • Utilize the ActionBar for app actions
  • Create a simple JSON-based persistent service to save data locally on the device
  • Lay out content using the LinearLayout, RelativeLayout, and TableLayout layout managers
  • Use a ListView (AdapterView) and Adapter to build a view that is populated by dynamic data
  • Capture the current location of a device and determine the street address
  • Integrate with the map app to display a point of interest
  • Capture and save a photo
  • Test, debug, and deploy an Android app

In Detail

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.

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.

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.

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.

Approach

A step-by-step tutorial that follows the development of a simple Android app from end to end, through troubleshooting, and then distribution. The language used assumes a knowledge of basic C#.

Who this book is for

If you are a C# developer with a desire to develop Android apps and want to enhance your existing skill set, then this book is for you. It is assumed that you have a good working knowledge of C#, .NET, and object-oriented software development. Familiarity with rich client technologies such as WPF or Silverlight is also helpful, but not required.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software