Introduction

Android is a popular, free, open-source mobile platform that has taken the world by storm. This book provides guidance for software development teams on designing, developing, testing, debugging, and distributing professional Android applications. If you’re a veteran mobile developer, you can find tips and tricks to streamline the development process and take advantage of Android’s unique features. If you’re new to mobile development, this book provides everything you need to make a smooth transition from traditional software development to mobile development—specifically, the most promising platform: Android.

Who Should Read This Book

This book includes tips for successful mobile development based upon our years in the mobile industry and covers everything you need to know in order to run a successful Android project from concept to completion. We cover how the mobile software process differs from traditional software development, including tricks to save valuable time and pitfalls to avoid. Regardless of the size of your project, this book is for you.

This book was written for several audiences:

Image Software developers who want to learn to develop professional Android applications. The bulk of this book is targeted at software developers with Java experience who do not necessarily have mobile development experience. More-seasoned developers of mobile applications can learn how to take advantage of Android and how it differs from the other technologies on the mobile development market today.

Image Quality assurance personnel tasked with testing Android applications. Whether they are black-box or white-box testing, quality assurance engineers can find this book invaluable. We devote several chapters to mobile QA concerns, including topics such as developing solid test plans and defect-tracking systems for mobile applications, how to manage handsets, and how to test applications thoroughly using all the Android tools available.

Image Project managers planning and managing Android development teams. Managers can use this book to help plan, hire for, and execute Android projects from start to finish. We cover project risk management and how to keep Android projects running smoothly.

Image Other audiences. This book is useful not only to the software developer, but also to the corporation looking at potential vertical market applications, the entrepreneur thinking about a cool phone application, and the hobbyist looking for some fun with his or her new phone. Businesses seeking to evaluate Android for their specific needs (including feasibility analysis) can also find the information provided valuable. Anyone with an Android handset and a good idea for a mobile application can put the information in this book to use for fun and profit.

Key Questions Answered in This Book

This book answers the following questions:

1. What is Android? How do the SDK versions differ?

2. How is Android different from other mobile technologies? How should developers take advantage of these differences?

3. How do developers use Android Studio and the Android SDK tools to develop and debug Android applications on the emulator and handsets?

4. How are Android applications structured?

5. How do developers design robust user interfaces for mobile—specifically, for Android?

6. What capabilities does the Android SDK have and how can developers use them?

7. What is material design and why does it matter?

8. How does the mobile development process differ from traditional desktop development?

9. What strategies work best for Android development?

10. What do managers, developers, and testers need to look for when planning, developing, and testing a mobile application?

11. How do mobile teams deliver quality Android applications for publishing?

12. How do mobile teams package Android applications for distribution?

13. How do mobile teams make money from Android applications?

14. And, finally, what is new in this edition of the book?

How This Book Is Structured

Introduction to Android Application Development, Fifth Edition, focuses on Android essentials, including setting up the development environment, understanding the application lifecycle, user interface design, developing for different types of devices, and the mobile software process from design and development to testing and publication of commercial-grade applications.

The book is divided into six parts. Here is an overview of the various parts:

Image Part I: Platform Overview

Part I provides an introduction to Android, explaining how it differs from other mobile platforms. You become familiar with the Android SDK tools, install the development tools, and write and run your first Android application—on the emulator and on a handset. This section is of primary interest to developers and testers, especially white-box testers.

Image Part II: Application Basics

Part II introduces the principles necessary to write Android applications. You learn how Android applications are structured and how to include resources, such as strings, graphics, and user interface components, in your projects. You learn about the core user interface element in Android: the View. You also learn about the most common user interface controls and layouts provided in the Android SDK. This section is of primary interest to developers.

Image Part III: Application Design Essentials

Part III dives deeper into how applications are designed in Android. You learn about material design, styling, and common design patterns found among applications. You also learn how to design and plan your applications. This section is of primary interest to developers.

Image Part IV: Application Development Essentials

Part IV covers the features used by most Android applications, including storing persistent application data using preferences, working with files and directories, SQLite, and content providers. This section is of primary interest to developers.

Image Part V: Application Delivery Essentials

Part V covers the software development process for mobile, from start to finish, with tips and tricks for project management, software developers, user-experience designers, and quality assurance personnel.

Image Part VI: Appendixes

Part VI includes several helpful appendixes to help you get up and running with the most important Android tools. This section consists of tips and tricks for Android Studio, an overview of the Android SDK tools, three helpful quick-start guides for the Android development tools—the emulator, Device Monitor, and Gradle—as well as answers to the end-of-chapter quiz questions.

An Overview of Changes in This Edition

When we began writing the first edition of this book, there were no Android devices on the market. Today, there are hundreds of millions of Android devices (with thousands of different device models) shipping all over the world every quarter—phones, tablets, e-book readers, smartwatches, and specialty devices such as gaming consoles, TVs, and Google Glass. Other devices such as Google Chromecast provide screen sharing between Android devices and TVs.

The Android platform has gone through extensive changes since the first edition of this book was published. The Android SDK has many new features, and the development tools have received many much-needed upgrades. Android, as a technology, is now the leader within the mobile marketplace.

In this new edition, we took the opportunity to add a wealth of information. But don’t worry, it’s still the book readers loved the first, second, third, and fourth time around; it’s just much bigger, better, and more comprehensive, following many best practices. In addition to adding new content, we’ve retested and upgraded all existing content (text and sample code) for use with the latest Android SDKs available, while still remaining backward compatible. We included quiz questions to help readers ensure they understand each chapter’s content, and end-of-chapter exercises for readers to perform to dig deeper into all that Android has to offer. The Android development community is diverse and we aim to support all developers, regardless of which devices they are developing for. This includes developers who need to target nearly all platforms, so coverage in some key areas of older SDKs continues to be included because it’s often the most reasonable option for compatibility.

Here are some of the highlights of the additions and enhancements we’ve made to this edition:

Image The entire book has been overhauled to include coverage of the Android Studio IDE. Previous editions of this book included coverage of the Eclipse IDE. Where applicable, all content, images, and code samples have been updated for Android Studio. In addition, coverage of the latest and greatest Android tools and utilities is included.

Image The chapter on defining the manifest includes coverage of the new Android 6.0 Marshmallow (API Level 23) permission model, and it provides a code sample demonstrating the new permission model.

Image A brand new chapter on material design has been added and demonstrates how developers can integrate common material design features into their application, and it includes a code sample.

Image A brand new chapter on working with styles has been included with tips on how to best organize styles and reuse common UI components for optimized display rendering, and it provides a code sample.

Image A brand new chapter on common design patterns has been added with details on various ways to architect your application, and it offers a code sample.

Image A brand new chapter on incorporating SQLite for working with persistent database-backed application data has been added, and it includes a code sample.

Image An appendix providing tips and tricks for using Android Studio has been included.

Image An appendix on the Gradle build system has been included to help you understand what Gradle is and why it’s important.

Image The AdvancedLayouts code sample has been updated so that the GridView and ListView components make use of Fragment and ListFragment classes respectively.

Image Some code samples include an ActionBar by making use of the new Toolbar, and have done so using the support library for maintaining compatibility on devices running older APIs. When necessary, application manifests have been updated to support parent-child Activity relationships that support up-navigation.

Image Many code samples make use of the AppCompatActivity class and the appcompat-v7 support library.

Image All chapters and appendixes include quiz questions and exercises for readers to test their knowledge of the subject matter presented.

Image All existing chapters have been updated, often with some entirely new sections.

Image All sample code and accompanying applications have been updated to work with the latest SDK.

As you can see, we cover many of the hottest and most exciting features that Android has to offer. We didn’t take this review lightly; we touched every existing chapter, updated content, and added new chapters as well. Finally, we included many additions, clarifications, and, yes, even a few fixes based on the feedback from our fantastic (and meticulous) readers. Thank you!

Development Environments Used in This Book

The Android code in this book was written using the following development environments:

Image Windows 7, 8, and Mac OS X 10.9

Image Android Studio 1.3.2

Image Android SDK API Level 23 (referred to in this book as Android Marshmallow)

Image Android SDK Tools 24.3.4

Image Android SDK Platform Tools 23.0.0

Image Android SDK Build Tools 23.0.0

Image Android Support Repository 17 (where applicable)

Image Java SE Development Kit (JDK) 7 Update 55

Image Android devices: Nexus 4, 5, and 6 (phones), Nexus 7 (first- and second-generation 7-inch tablet), Nexus 9 and 10 (large tablet), including various other popular devices and form factors.

The Android platform continues to grow aggressively in market share against competing mobile platforms, such as Apple iOS, Windows Phone, and BlackBerry OS. New and exciting types of Android devices reach consumers’ hands at a furious pace. Developers have embraced Android as a target platform to reach the device users of today and tomorrow.

Android’s latest major platform update, Android Marshmallow, brings many new features. This book covers the latest SDK and tools available, but it does not focus on them to the detriment of popular legacy versions of the platform. The book is meant to be an overall reference to help developers support as many popular devices as possible on the market today. As of the writing of this book, approximately 9.7% of users’ devices are running a version of Android Lollipop, 5.0 or 5.1, and Android Marshmallow has yet to be released on real devices. Of course, some devices will receive upgrades, and users will purchase new Lollipop and Marshmallow devices as they become available, but for now, developers need to straddle this gap and support numerous versions of Android to reach the majority of users in the field. In addition, the next version of the Android operating system is likely to be released in the near future.

So what does this mean for this book? It means we provide legacy API support and discuss some of the newer APIs available in later versions of the Android SDK. We discuss strategies for supporting all (or at least most) users in terms of compatibility. And we provide screenshots that highlight different versions of the Android SDK, because each major revision has brought with it a change in the look and feel of the overall platform. That said, we are assuming that you are downloading the latest Android tools, so we provide screenshots and steps that support the latest tools available at the time of writing, not legacy tools. Those are the boundaries we set when trying to determine what to include and leave out of this book.

Supplementary Materials for This Book

The source code that accompanies this book is available for download from our book’s website: http://introductiontoandroid.blogspot.com/2015/08/5th-edition-book-code-samples.html. The code samples are organized by chapter and downloadable in zip format or accessible from the command line with Git. You’ll also find other Android topics discussed on our book’s website (http://introductiontoandroid.blogspot.com).

Conventions Used in This Book

This book uses the following conventions:

Image Code and programming terms are set in monospace text.

Image Java import statements, exception handling, and error checking are often removed from printed code examples for clarity and to keep the book to a reasonable length.

This book also presents information in the following sidebars:


Image Tip

Tips provide useful information or hints related to the current text.



Image Note

Notes provide additional information that might be interesting or relevant.



Image Warning

Warnings provide hints or tips about pitfalls that may be encountered and how to avoid them.


Where to Find More Information

There is a vibrant, helpful Android developer community on the Web. Here are a number of useful websites for Android developers and followers of the mobile industry:

Image Android Developer website: the Android SDK and developer reference site:
http://d.android.com/index.html and http://d.android.com

Image Google Plus: Android Developers Group:
https://plus.google.com/+AndroidDevelopers/posts

Image YouTube: Android Developers and Google Design:
https://www.youtube.com/user/androiddevelopers
https://www.youtube.com/channel/UClKO7be7O9cUGL94PHnAeOA

Image Google Material Design:
https://www.google.com/design/spec/material-design/introduction.html

Image Stack Overflow: the Android website with great technical information (complete with tags) and an official support forum for developers:
http://stackoverflow.com/questions/tagged/android

Image Android Open Source Project:
https://source.android.com/index.html

Image Open Handset Alliance: Android manufacturers, operators, and developers:
http://openhandsetalliance.com

Image Google Play: buy and sell Android applications:
https://play.google.com/store

Image tuts+: Android development tutorials:
http://code.tutsplus.com/categories/android

Image Google Sample Apps: open-source Android applications hosted on GitHub:
https://github.com/googlesamples

Image Android Tools Project Site: the tools team discusses updates and changes:
https://sites.google.com/a/android.com/tools/recent

Image FierceDeveloper: a weekly newsletter for wireless developers:
http://fiercedeveloper.com

Image XDA-Developers Android Forum:
http://forum.xda-developers.com/android

Image Developer.com: a developer-oriented site with mobile articles:
http://developer.com

Contacting the Authors

We welcome your comments, questions, and feedback. We invite you to visit our blog at:

Image http://introductiontoandroid.blogspot.com

Or email us at:

Image [email protected]

Find Joseph Annuzzi on LinkedIn:

Image Joseph Annuzzi, Jr.: https://www.linkedin.com/in/josephannuzzi

Circle Joseph Annuzzi on Google+:

Image Joseph Annuzzi, Jr.: http://goo.gl/FBQeL

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.20.224.107