Table Of Content
Learn Android App Development
Wallace Jackson
Learn Android App Development
Copyright © 2013 by Wallace Jackson This work is subject to copyright.
All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting,
reuse of illustrations, recitation, broadcasting, reproduction on
microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by
similar or dissimilar methodology now known or hereafter developed.
Exempted from this legal reservation are brief excerpts in connection
with reviews or scholarly analysis or material supplied specifically for
the purpose of being entered and executed on a computer system, for
exclusive use by the purchaser of the work. Duplication of this
publication or parts thereof is permitted only under the provisions of the
Copyright Law of the Publisher’s location, in its current version, and
permission for use must always be obtained from Springer. Permissions
for use may be obtained through RightsLink at the Copyright Clearance
Center. Violations are liable to prosecution under the respective
Copyright Law.
ISBN-13 (pbk): 978-1-43025746-2
ISBN-13 (electronic): 978-1-4302-5747-9
Trademarked names, logos, and images may appear in this book. Rather
than use a trademark symbol with every occurrence of a trademarked
name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks,
and similar terms, even if they are not identified as such, is not to be
taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
The images of the Android Robot (01 / Android Robot) are reproduced
from work created and shared by Google and used according to terms
described in the Creative Commons 3.0 Attribution License. Android and
all Android and Google-based marks are trademarks or registered
trademarks of Google, Inc., in the U.S. and other countries. Apress
Media, L.L.C. is not affiliated with Google, Inc., and this book was
written without endorsement from Google, Inc.
While the advice and information in this book are believed to be true and
accurate at the date of publication, neither the authors nor the editors nor
the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express
or implied, with respect to the material contained herein.
President and Publisher: Paul Manning Lead Editor: James
Markham
Technical Reviewer: Michael Thomas Editorial Board: Steve
Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell,
Louise Corrigan, Morgan Ertel, Jonathan Gennick, Jonathan
Hassell, Robert Hutchinson, Michelle Lowman, James
Markham, Matthew Moodie, Jeff Olson, Jeffrey Pepper,
Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft,
Gwenan Spearing, Matt Wade, Tom Welsh Coordinating
Editor: Mark Powers Copy Editor: Editorial Advantage,
LLC
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer Science+Business
Media New York, 233 Spring Street, 6th Floor, New York, NY 10013.
Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-
ny@springer-sbm.com, or visit www.springeronline.com.
Apress Media, LLC is a California LLC and the sole member (owner) is
Springer Science + Business Media Finance Inc (SSBM Finance Inc).
SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com,
or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic,
corporate, or promotional use. eBook versions and licenses are also
available for most titles. For more information, reference our Special
Bulk Sales–eBook Licensing web page at www.apress.com/bulk-
sales.
Any source code or other supplementary materials referenced by the
author in this text is available to readers at
www.apress.com/9781430257462. For detailed information
about how to locate your book’s source code, go to
www.apress.com/source-code/.
This book is dedicated to everyone in the open source community
who is working diligently to make professional level software and
new media development tools available for everybody to use to
achieve their dreams and goals. Last, but certainly not least, to my
family, friends, and neighbors for their help, assistance, and those
great late night BBQs.
Contents at a Glance
About the Author
About the Technical Reviewer
Acknowledgments
Introduction
Chapter 1: Building an Android IDE for Version 4.2:
Acquiring, Installing, and Configuring an Android Development
Environment
Chapter 2: Exploring Android App Development: The Lingo of
Android and Building Your First Hello World App!
Chapter 3: Java for Android Primer: Enhancing Our Hello
World Application
Chapter 4: Layouts and Activities: Using ViewGroup Classes
Chapter 5: Android Intents and Events: Adding Interactivity
Chapter 6: Android UI Design: Using Views and Widgets via
XML
Chapter 7: Android Graphics Design: Concepts and
Techniques
Chapter 8: Compositing in Android: Advanced Graphical User
Interface Design
Chapter 9: Android Image Animation: Frame-Based
Animation Using XML Constructs
Chapter 10: Android Vector Animation: Procedural Animation
via XML Constructs
Chapter 11: An Introduction to Video: Concepts and
Optimization
Chapter 12: Digital Video in Android: Using the VideoView
Class
Chapter 13: An Introduction to Audio: Concepts and
Optimization
Chapter 14: Playing Audio in Android: The MediaPlayer Class
Chapter 15: Audio Sequencing: Android SoundPool Class
Chapter 16: Android Intents: Inter-Application Programming
Chapter 17: Android Services: Using Background Processing
Chapter 18: Broadcast Receivers: Android Inter-Application
Communication
Chapter 19: Android Content Providers: Access to Datastores
Appendix A: Building an Android IDE for Version 4.12 and
Earlier: Acquiring, Installing, and Configuring an Android
Development Environment
Index
Contents
About the Author
About the Technical Reviewer
Acknowledgments
Introduction
Chapter 1: Building an Android IDE for Version 4.2:
Acquiring, Installing, and Configuring an Android Development
Environment
Our Plan of Attack
Foundation of Android Programming: Java 6
Installing the JDK
The Android Developer Tools (ADT) Bundle
Downloading the Android ADT IDE
Configuring Android Virtual Devices (AVDs)
Creating Your Nexus 7 Tablet Emulator
Creating Your Nexus S Smartphone Emulator
Creating Your Android iTV Emulator for GoogleTV Support
New Media Tools Used in Android Development
Digital Imaging Software: GIMP 2.8.4
Digital Audio Software: Audacity 2.0.3
Digital Video Software: EditShare Lightworks 11
3D Modeling and Animation Software: Blender 3D
Summary
Chapter 2: Exploring Android App Development: The Lingo of
Android and Building Your First Hello World App!
Android Application Development Lingo
The Foundation of Android: The Linux 2.6 Kernel
Android Optimization: The Dalvik Virtual Machine (DVM)
Android Activities: The Presentation Layer
Android Services: The Processing Layer
Android Broadcast Receivers: The Communications Layer
Android Content Providers: The Data Storage Layer
Android Intents: Inter-Application Communications
Android Manifest: Application Permissions Definition
Creating Your First Android Application
Anatomy of an Android Application Project
Android Application Project: XML Mark-Up
Creating User Interface Screen Layouts in Android Using XML
Creating Option Menus in Android Using XML
Setting Constant Values for Your Android Application Using XML
Android Application Project: Java Coding
Defining the Android Classes via Import Statements
Creating Our Application Infrastructure Using the onCreate( ) Method
Running Your Hello World App in the Android 4.2 Emulator
Setting Up Logcat after Your First Android 4.2 Emulation
Summary
Chapter 3: Java for Android Primer: Enhancing Our Hello
World Application
Java’s Highest Level: The Application Programming Interface
Organizing the Java API: The Package
The Foundation of Java: The Object