Xamarin Mobile Application Development for Android - Second Edition

Xamarin Mobile Application Development for Android - Second Edition

Read it now on the O’Reilly learning platform with a 10-day free trial.

O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Book description

Develop, test, and deliver fully-featured Android applications using Xamarin

About This Book

Who This Book Is For

If you are a C# developer who wants to develop Android apps and enhance your existing skill set, then this book is ideal for you. Good working knowledge of C#, .NET, and object-oriented software development is assumed.

What You Will Learn

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 learn the fundamentals of Android app development using C# and Xamarin.Android. It will lead you through building an Android app step-by-step with steadily increasing complexity.

Beginning with an overview of the Android and Xamarin platforms to provide you with a solid understanding of the underlying platform, we gradually walk through building and testing a Points of Interest Android app using C# and the Xamarin.Android product. You will learn to create ListView and add detail view to your Android application. You will handle application behaviors on orientation changes, before learning the different techniques to manage resources and layouts to support multiple screen sizes. You will then access a SQLite database in a cross-platform way and add location features to your application. Finally, you will add camera integration to your application and deploy your app to the various Android app stores.

Style and approach

An example-oriented, comprehensive guide to gain an understanding of both the Android and Xamarin platforms.

Show and hide more Table of contents Product information

Table of contents

  1. Xamarin Mobile Application Development for Android Second Edition
    1. Table of Contents
    2. Xamarin Mobile Application Development for Android Second Edition
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
          1. The Android platform
            1. Versions of Android
            2. The Linux kernel
            3. Native libraries
            4. The Android runtime
            1. The application layer
            1. The Android packages (.apk)
            2. The application manifest
            3. Activities
              1. The life cycle of an activity
              2. The events of an activity
              1. The fragment life cycle
              1. Element and attribute names
              2. The View and layout identifiers
              1. Getting started with Xamarin
              2. Why Xamarin.Android?
                1. The benefits of using Xamarin.Android
                2. The drawbacks of using Xamarin.Android
                1. The Java Native Interface
                2. Peer objects
                3. Xamarin.Android application packaging
                1. Design principles
                2. C# properties
                3. Delegates
                4. Constants to enumerations
                1. Xamarin Studio
                2. Xamarin for Visual Studio
                3. IDE comparison
                4. Compatibility
                1. The sample POIApp
                2. Installing Xamarin.Android
                3. Installing platforms and tools
                  1. Tools
                  2. The Android platform APIs
                  3. The Android platform Extras
                  1. Using the x86 emulator
                  2. Third-party emulator solutions
                    1. The Xamarin Android Player
                    2. Genymotion
                    1. Understanding the project structure
                    1. The designer content layout
                    2. The Document Outline and Properties pads
                    3. Toolbox
                    4. Setting the target framework
                    1. Enabling USB debugging
                    2. Installing a USB driver
                    3. Running apps on a device
                    4. Behind the scenes
                    5. The peer object
                    1. Creating the POI ListView layout
                    2. Creating POIListActivity
                    3. Creating the POI list row layout
                      1. Adding a RelativeLayout view group
                      2. Adding an ImageView widget
                      3. Adding a LinearLayout widget
                      4. Adding the name and address TextView classes
                      5. Adding the distance TextView
                      1. Implementing a constructor
                      2. Implementing Count
                      3. Implementing GetItemId()
                      4. Implementing the index getter method
                      5. Implementing GetView()
                      6. Reusing row Views
                      1. Populating the list thumbnail image
                        1. Using UrlImageViewHelper
                        2. Adding Internet permissions
                        1. An introduction to web services
                        2. Deploying the POI web service
                        3. Consuming REST web services asynchronously
                        4. Creating the POIService class
                        5. Asynchronous programming with async and await
                        6. Serializing and deserializing using Json.NET
                        7. Updating POIListActivity
                        1. Creating the POIDetail layout
                          1. Understanding ScrollView
                          2. Using the TableLayout manager
                          3. Working with EditText's InputType
                          1. Navigation on the POIList item click
                          1. Binding variables to controls
                          1. Disabling the delete action
                          1. Consuming the web service to create or update a POI
                          2. Adding the CreateOrUpdatePOIAsync method to POIService
                          3. Consuming the web service to delete the POI
                          4. Adding the DeletePOIAsync method to POIService
                          1. Using the EditText.Error property
                          2. Adding a delete confirmation prompt
                          1. The Android behavior on configuration changes
                          2. Locking the Android application orientation
                          3. Dynamically requesting the orientation
                          4. Saving the activity state for configuration changes
                            1. Manually saving the activity state
                            2. Retaining the POI list scroll position
                            1. An introduction to Android tablets
                            2. Creating an Android tablet emulator
                            3. An introduction to fragments
                              1. Creating a new fragment
                              1. Creating the POIDetailsFragment layout
                              2. Creating the POIDetailFragment
                              3. Working with the save and delete actions
                              4. Adding the POIDetailFragment to POIDetailActivity
                                1. Modifying the POI details activity layout
                                2. Refactoring POIDetailActivity to add POIDetailFragment
                                1. Understanding ListFragment
                                2. Creating the POIListFragment layout
                                3. Creating the fragment to display the POI list using POIListFragment
                                4. Adding POIListFragment to POIListActivity
                                  1. Modifying the POI list activity layout
                                  2. Adding POIListFragment to POIListActivity
                                  1. Data storage in Android
                                    1. Shared preferences
                                    2. The SQLite database storage
                                    1. Using attributes to mark POIApp to be persisted
                                    2. Adding a database helper class
                                      1. Creating or updating the POI record
                                      2. Reading POI details from the database
                                      3. Deleting the POI data from the database
                                      1. Setting up for tests
                                      2. Creating the test methods
                                        1. The CreatePOI test
                                        2. The DeletePOI test
                                        1. Working with location services
                                          1. Setting the app permissions
                                          2. Configuring the emulator
                                          3. Obtaining an instance of LocationManager
                                          1. Implementing ILocationListener
                                          1. Adding location services to the POI list
                                          2. Adding location services to POI details
                                            1. Updating the user interface
                                            2. Adding the code
                                            1. Navigating to the Map app
                                            2. Checking for registered map apps
                                            1. Picking an integration approach
                                            2. Permissions and features
                                            3. Configuring the emulator
                                            4. Extending the data service
                                              1. Implementing GetFileName()
                                              2. Implementing GetImage()
                                              3. Implementing DeleteImage()
                                              1. Adding UI elements
                                              2. Creating the camera Intent
                                              3. Checking for registered camera apps
                                              4. Providing additional information with the Intent
                                                1. Providing a filename and location
                                                2. Providing a size limit
                                                1. Preparing the application for release
                                                  1. Disabling the debug mode
                                                  2. Configuring linking options
                                                    1. Side effects of linking
                                                    1. The package name
                                                    2. The application name and icon
                                                    3. The application versioning scheme
                                                    1. Android keystores
                                                    2. Publishing from Xamarin.Android
                                                    3. Republishing the app
                                                    1. Self-publishing via website links or e-mails
                                                    2. Publishing on Google Play
                                                    3. Third-party app stores
                                                    Show and hide more

                                                    Product information

                                                    • Title: Xamarin Mobile Application Development for Android - Second Edition
                                                    • Author(s): Nilanchala Panigrahy
                                                    • Release date: August 2015
                                                    • Publisher(s): Packt Publishing
                                                    • ISBN: 9781785280375