Professional Android Programming with Mono for Android and .Net/C#

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

A one-of-a-kind book on Android application development with Mono for Android The wait is over! For the millions of .NET/C# developers who have been eagerly awaiting the book that will guide them through the white-hot field of Android application programming, this is the book. As the first guide to focus on Mono for Android, this must-have resource dives into writing applications against Mono with C# and compiling executables that run on the Android family of devices. Putting the proven Wrox Professional format into practice, the authors provide you with the knowledge you need to become a successful Android application developer without having to learn another programming language. You'll explore screen controls, UI development, tables and layouts, and MonoDevelop as you become adept at developing Android applications with Mono for Android. Answers the demand for a detailed book on the extraordinarily popular field of Android application development Strengthens your existing skills of writing applications and shows you how to transfer your talents to building Android apps with Mono for Android and .NET/C# Dives into working with data, REST, SOAP, XML, and JSON Discusses how to communicate with other applications, deploy apps, and even make money in the process Professional Android Programming with Mono for Android and .NET/C# gets you up and running with Android app development today.

Author(s): Wallace B. McClure; Nathan Blevins; John J. Croft IV; Jonathan Dick; Chris Hardy
Publisher: Wrox Press
Year: 2012

Language: English
Pages: 520

Professional Android™ Programming With Mono For Android And .Net/C#
Contents
Foreword
Introduction
Chapter 1: Introduction to Android, Mobile Devices, and the Marketplace
Product Comparison
The .NET Framework
Mono
Mono for Android
Mono for Android Components
Development Tools
Mobile Development
Getting Around Support Issues
Design Issues
Android
History of Android
Writing Web-Based Applications for Android
Writing Native Applications for Android
Android Development Issues
Android SDK Tools
Android Development Costs
Cross-Platform Alternatives
Other Cross-Platform Tools
Considerations for Selecting a Cross-Platform Tool
How Does the Tool Allow You to Author Your Application?
What Device Features Does the Tool Support?
What Platforms Does the Tool Support?
What Skill Sets Does the Tool Require?
What Tools Exist to Support Development?
How Active Are the Development Community and Support Channels?
What Are the Successful Application Deployments for This Tool?
Summary
Chapter 2: Introduction to Mono for Android
Before You Begin Developing
What Is Mono?
Mono Implementation Goals
Mono Standards
What Is Mono for Android?
Why Do I Need Mono for Android?
Familiar Development Environment
Familiar API and Library Structure
What Are the Trade-Offs of Working with Mono for Android?
Waiting for Improvements
Taking a Potential Performance Hit
Memory Management
What Do I Need for the Mono for Android Development Environment?
Java SDK
Android SDK
Visual Studio
Visual Studio Development with Mono for Android
General Setup
Building Hello Android
Logging
Debugging
Testing
Deploying
Mono for Android Development with MonoDevelop
General Setup
Building Hello Android
Logging
Debugging
Testing
Deploying
Summary
Chapter 3: Understanding Android/Mono for Android Applications
What Is an Android Application?
The Building Blocks of an Android Application
Activities
Services
Content Providers
Broadcast Receivers
Communicating between Components: Android Intents
Binding the Components: The Android Manifest
Android Manifest Basics
Editing the Manifest for Mono for Android via Visual Studio
Summary
Chapter 4: Planning and Building Your Application’s User Interface
Guidelines for a Successful Mobile UI
Building an Android UI
Views
Design Surface
Choosing a Control Layout
AbsoluteLayout
FrameLayout
LinearLayout
RelativeLayout
TableLayout
Optimizing Layouts
Designing Your User Interface Controls
TextView
EditText
AutoCompleteTextView
Spinner
Button
Check Box
Radio Buttons and Groups
Clocks
Pickers
Images
ImageView
ImageButton
Gallery
Virtual Keyboards
Selecting Your Virtual Keyboard
Removing the Keyboard
Controlling Your Menus
Introducing the Menu System
Menus
Submenus
Context Menus
Defining Menus as a Resource
Menus
Context Menus
Resolution-Independent UI
Supporting Various Screen Resources
Supporting Screen Sizes
Supporting Pixel Densities
Using Android Market Support
Multiple Screen Resolution Best Practices
Constructing a User Interface: A Phone and Tablet Example
Summary
Chapter 5: Working with Data
Working with SQLite
Setting Up a Database
Setting Up Tables
Using SQL Statements
Using Read/Select to Read Data
Using SQL Statements to Insert Data
Upgrading Strategies
Upgrading in Place
Copying Data
Android-Specific Database Options
SQLiteOpenHelper
Storing Data Remotely
Working with Remote Data
Accessing Enterprise Services
Using SOAP
Working with ASMX Web Services
Working with Windows Communication Foundation (WCF)
Using REST-Based Web Services
Using JavaScript Object Notation (JSON)
Posting Data with POST
Retrieving Data Using LINQ and XML
Using Asynchronous Data Retrieval
Using Web Services Responsibly
Working with Remote SQL Server Databases
Summary
Chapter 6: Binding Data to Controls
Databinding in Mono for Android
What Is a Data Adapter?
What Is an Adapter View?
How Do These Items Relate to One Another?
Working with Adapter Views and Large Data Sets
Exploring Adapters in Depth
Using Native Adapters
Exploring Adapter Views in Depth
Using Native Adapter Views
Working with Cursors
Using a Cursor to Populate a Spinner
Setting Up the Spinner and Data Source
Using a Spinner Adapter
Adding a Listener Event for a Spinner
Using a Cursor with a Gallery
Setting Up the Project
Adding the Cursor
Completing the Custom Adapter
Working with Lists
Displaying Simple Data in a List
Working with Android’s ListAdapters
Customizing ListView with a Custom List Adapter
Handling ListView Events
Preferences Screen
Nested Navigation
Grouped Lists
Displaying Data in a Grid
Summary
Chapter 7: Working with the File System and Application Preferences
Working with the File System
File System Type and Structure
QuickEdit Sample Program: Working with a File Storage Example
Working with Application Preferences
Application Preference Types
Creating Your Own Application Preferences
Preferences Program
Listening for Preference Changes
Processing XML
Summary
Chapter 8: Programming with the Device Hardware
Working with Sensors
Referencing the Sensor Manager
Sensor Support
Accessing Sensors
Using Sensors
Understanding the Sensor Type Values
Responding to Acceleration
Using the XYZ Coordinate System
Coding with the Accelerometer
Building a Compass
Vibration
Networking Connectivity
ConnectivityManager
Checking User Communication Preferences
Checking for Changes to BackgroundDataSetting
Checking Current Network Configuration
Creating Network Connectivity Notifications
WifiManager
WiFi States
WiFi Changes
Bluetooth Manager
Working with Bluetooth State
Enabling Voice Recognition in Your App
Getting Turn-by-Turn Directions
Summary
Chapter 9: Using Multimedia?—?Audio, Video, and the Camera
Android Media Classes
Playing Audio and Video
Media Player Supported Formats
Programming Audio Playback
Programming Video Playback
Controlling Playback
Managing Playback Output
Recording Audio and Video
Using Intents to Record Video
Using the Media Recorder
Configuring Video Recording
Previewing Video Recording
Audio Recording
Images and Using the Camera
Using Intents to Take Pictures
Controlling the Camera
Managing Camera Settings and Picture Options
Monitoring Autofocus
Using the Camera Preview
Taking a Picture
Reading and Writing JPEG Exif Values
Adding New Media to the Media Store
Using the Media Scanner
Adding New Media to the Store
Speech Recognition
Summary
Chapter 10: Talking to Other Applications and Libraries
Android Application Integration
Opening the Browser
Opening E-mail
Making a Telephone Call
Sending a Text/SMS Message
Opening a Location in the Maps Application
Opening a YouTube Video
Opening the Market
Application Integration
Simple Integration with HootSuite and Other Twitter Applications
Configuring Your Intent Filters
Handling Incoming Intent Requests
Integrating with Contacts
Displaying Contact Details
Picking a Contact
Creating a New Contact
Creating a New Contact or Adding to an Existing Contact
Summary
Chapter 11: Developing Background Services and Asynchronous Code
The Life Cycle of a Service
Creating Your First Service
Prioritizing Services
Using Threads for Asynchronous Processing
Threading Manually
Utilizing System.Threading.Tasks
Implicit Threading with the IntentService
Communicating with the UI
Using the Binder and Service Connection Method
Using the Broadcast Receiver Method
Using the Static Event Method
Notifying the User with Notifications
Scheduling Intents with Alarms and the IntentService
Push Notifications Using Cloud to Device Messaging (C2DM)
Listening for C2DM in Your Application
Sending a C2DM Message from Your Server
Summary
Chapter 12: Canvas and Drawables: Building Custom Android Graphics
Working with Graphics in Mono for Android
Using the Canvas Object
Graphics Primitives
The Canvas Object
The Paint Object
The Bitmap Object
Bringing It All Together
A Path Primer
Case 1: Creating a Custom Graphic
Case 2: Responding to Events
Case 3: Animating Custom Graphics
Case 4: Improving Performance Using SurfaceView
Selecting the Best Approach
The 2D Graphics Library
Using Drawables
Drawables as XML Resources
Simple and Compound Drawables
Drawables in Action
Case 1: Using Default Drawables
Case 2: Adding Polish with the Shape Drawable
Case 3: Using the Gradient Drawable
Case 4: Using the Compound Drawable
Case 5: Interacting with a Custom Drawable
Summary
Chapter 13: Working with Location Information
Understanding Location Basics
Determining Location
Location-Based Data Interruptions
Using Location-Based Services
Configuring Location-Based Applications on the Emulator
Selecting a Location Provider
Determining Which Providers Are Available
Finding Location Providers with Criteria
Geocoding
Forward Geocoding
Reverse Geocoding
Constructing Proximity Alerts
Using Google Maps
Getting Your Development/Debugging MD5 Fingerprint
Getting Your Production/Release MD5 Fingerprint
Creating the Maps-Based Activity
Creating a Map in a Layout File
Using the MapView Controller with an Overlay
Summary
Chapter 14: Internationalization and Localization
Selecting a Localization Strategy
Updating Language and Regional Settings
Understanding the Mechanics of Android Localization
Setting Up Default Resources
Adding Localization Support
Resource Selection in Detail
Supporting Multiple Languages
Utilizing the Strings.xml File
Translating Text
Translating Control Text
Localizing Other Resources
Localizing the Menu Icon and Application Name
Advanced Usage of Strings.xml
String Array
Plurals
String Replacements
Working with Format Conversions
Formatting Dates
Formatting Numbers and Currency
Summary
Chapter 15: Sharing Code between Mono for Android, MonoTouch, and Windows Phone 7
Overview of the Three Platforms
Mono for Android
MonoTouch
Windows Phone 7
Using Class Libraries to Separate the Code
Using Preprocessor Directives
Mono for Android
Windows Phone 7
MonoTouch
Assemblies Available on Each Platform
One Class Library to Rule Them All
Mono for Android
MonoTouch
Windows Phone 7
Putting It All Together: Creating a Cross-Platform Application
Summary
Chapter 16: Preparing and Publishing Your Application to the Market
Preparing Your Application
Testing Your Application
Hitting the Key Testing Areas
Tools for the Testing Trade
Unit Testing
DDMS
The Emulator
Traceviews
Stress Testing via the Application Exerciser Monkey
UI Testing via the Monkeyrunner
Involving Peers and Users in the Testing Process
Publishing Your Application to the Android Market
Versioning Your Application
Creating the Final Build
Signing Your Application
Creating a Private Key
Creating a Self-Signed Certificate
Aligning the Final Package
Uploading to the Android Market
Summary
Chapter 17: Android Tablets
Examining the Android Tablet Marketplace
Designing a Tablet UI
Using the Action Bar
Removing the Action Bar
Adding Items to the Action Bar
Using the Application Icon
Navigating “Up” the Stack
Adding and Using Action Items
Creating a Tabbed Interface
Partial Screen Control Using Fragments
Creating Fragments
More Fragments
Summary
Appendix A: Tips for Developers and the Future of Mono and Android
Best Practices, Hints, Tips, and Gotchas
Android Honeycomb (3.0) and Ice Cream Sandwich (4.0)
Fragments for All!
Android Version and Device Fragmentation
What’s Next for Mono for Android?
Using Xamarin.Mobile for Cross-Platform Mobile Functionality
Index
Advertisements