售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Xamarin Mobile Application Development for Android Second Edition
Table of Contents
Xamarin Mobile Application Development for Android Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. The Anatomy of an Android App
The Android platform
Versions of Android
The Linux kernel
Native libraries
The Android runtime
The application framework
The application layer
The building blocks of the Android application
The Android packages (.apk)
The application manifest
Activities
The life cycle of an activity
The events of an activity
Fragments
The fragment life cycle
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
The View and layout identifiers
Using XML layouts from activities
Intents
Resources
The R.java file
Summary
2. The Xamarin.Android Architecture
Getting started with Xamarin
Why Xamarin.Android?
The benefits of using Xamarin.Android
The drawbacks of using 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
3. Creating the Points Of Interest App
The sample POIApp
Installing Xamarin.Android
Installing platforms and tools
Tools
The Android platform APIs
The Android platform Extras
Creating Android Virtual Devices
Cloning a virtual device
Speeding up the Android emulator
Using the x86 emulator
Third-party emulator solutions
The Xamarin Android Player
Genymotion
Creating the POI app
The Xamarin Studio IDE
The Project Options view
Understanding the project structure
The Xamarin Studio layout designer
The designer content layout
The Document Outline and Properties pads
Toolbox
Setting the target framework
Setting the app icon and package name
The launcher activity
Running and debugging the app
Debugging with an Android device
Enabling USB debugging
Installing a USB driver
Running apps on a device
Behind the scenes
The peer object
The AndroidManifest.xml file
Summary
4. Adding a List View
Creating the POI ListView layout
Creating POIListActivity
Creating the POI list row 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
Creating the PointOfInterest apps entity class
Populating the ListView item
Creating POIListViewAdapter
Implementing a constructor
Implementing Count { get }
Implementing GetItemId()
Implementing the index getter method
Implementing GetView()
Reusing row Views
Populating row Views
Populating the list thumbnail image
Using UrlImageViewHelper
Adding Internet permissions
Hooking up POIListViewAdapter
Consuming the web service
An introduction to web services
Deploying the POI web service
Consuming REST web services asynchronously
Creating the POIService class
Asynchronous programming with async and await
Serializing and deserializing using Json.NET
Updating POIListActivity
Adding actions to ActionBar
Defining the menu XML file
Setting menus in OnCreateOptionsMenu()
Handling selection in OnOptionsItemSelected()
Handling the ListView click event
Handling no network condition
Toast
Summary
5. Adding a Details View
Creating the POIDetail layout
Understanding ScrollView
Using the TableLayout manager
Working with EditText's InputType
Creating POIDetailActivity
Adding navigation to POIDetailActivity
Navigation on the POIList item click
Receiving the data in POIDetailActivity
Binding variables to controls
Populating user interface widgets
Adding the save and delete actions
Disabling the delete action
Adding the save and delete actions in POIService
Consuming the web service to create or update a POI
Adding the CreateOrUpdatePOIAsync method to POIService
Consuming the web service to delete the POI
Adding the DeletePOIAsync method to POIService
Creating SavePOI()
Creating DeletePOI()
Adding validation
Using the EditText.Error property
Adding a delete confirmation prompt
Refreshing POIListActivity
Summary
6. Making Your App Orientation-aware
The Android behavior on configuration changes
Locking the Android application orientation
Dynamically requesting the orientation
Saving the activity state for configuration changes
Manually saving the activity state
Retaining the POI list scroll position
Building the orientation-aware layout
Manually handling the orientation behavior
Summary
7. Designing for Multiple Screen Sizes
An introduction to Android tablets
Creating an Android tablet emulator
An introduction to fragments
Creating a new fragment
Making POIApp compatible with Android tablets
Using fragments for displaying POIDetails
Creating the POIDetailsFragment layout
Creating the POIDetailFragment
Working with the save and delete actions
Adding the POIDetailFragment to POIDetailActivity
Modifying the POI details activity layout
Refactoring POIDetailActivity to add POIDetailFragment
Using the list fragment for displaying the POI list
Understanding ListFragment
Creating the POIListFragment layout
Creating the fragment to display the POI list using POIListFragment
Adding POIListFragment to POIListActivity
Modifying the POI list activity layout
Adding POIListFragment to POIListActivity
Creating a multi-pane layout for tablets
Updating the POIApp to support the multi-pane split layout
Working with DialogFragment
Fragments for older Android devices
Handling configuration changes with fragments
Summary
8. Creating Data Storage Mechanisms
Data storage in Android
Shared preferences
The SQLite database storage
Using the SQLite.net ORM component
Using attributes to mark POIApp to be persisted
Adding a database helper class
Creating or updating the POI record
Reading POI details from the database
Deleting the POI data from the database
Using the Xamarin.Android NUnitLite
Setting up for tests
Creating the test methods
The CreatePOI test
The DeletePOI test
Executing the tests
Implementing the caching logic to POIApp
Summary
9. Making POIApp Location Aware
Working with location services
Setting the 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 the POI list
Adding location services to POI details
Updating the user interface
Adding the code
Mocking location data for testing
Getting an address for a location
Keeping the user informed
Adding map integration
Navigating to the Map app
Checking for registered map apps
Summary
10. Adding the Camera App Integration
Picking an integration approach
Permissions and features
Configuring the emulator
Extending the data service
Implementing GetFileName()
Implementing GetImage()
Implementing DeleteImage()
Capturing an image from POIDetailFragment
Adding UI elements
Creating the camera Intent
Checking for registered camera apps
Providing additional information with the Intent
Providing a filename and location
Providing a size limit
Starting the Intent
Completing the NewPhotoClicked() method
Processing the results of the Intent
Upload an image using an HTTP multipart
Summary
11. Publishing an App to the App Store
Preparing the application for release
Disabling the debug mode
Configuring linking options
Side effects of linking
Selecting supported ABIs
Verifying the package name, icon, and app version
The package name
The application name and icon
The application versioning scheme
Review user permissions
Publishing a signed APK for uploading
Android keystores
Publishing from Xamarin.Android
Republishing the app
Different app distribution options
Self-publishing via website links or e-mails
Publishing on Google Play
Third-party app stores
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜