Android™ Application Development All-in-One For Dummies

by Barry Burd

8 BOOKS IN 1


e-books shop
e-books shop
Purchase Now !
Just with Paypal



Book Details
 Price
 2.00 USD
 Pages
 887 p
 File Size
 13,227 KB
 File Type
 PDF format
 ISBN
 978-1-118-02770-7 (pbk) 
 978-1-118-22229-4 (ebk)
 978-1-118-23595-9 (ebk)
 978-1-118-24501-9 (ebk)
 Copyright   
 2004 Martin Evening   

About the Author
Barry Burd received an M.S. degree in Computer Science at
Rutgers University and a Ph.D. in Mathematics at the University of
Illinois. As a teaching assistant in Champaign-Urbana, Illinois, he was
elected five times to the university-wide List of Teachers Ranked as
Excellent by their Students.
Since 1980, Dr. Burd has been a professor in the Department of
Mathematics and Computer Science at Drew University in Madison, New
Jersey. When he’s not lecturing at Drew University, Dr. Burd leads
training courses for professional programmers in business and industry.
He has lectured at conferences in the United States, Europe, Australia,
and Asia. He is the author of several articles and books, including Java
For Dummies and Beginning Programming with Java For Dummies, both
from John Wiley & Sons, Inc.
Dr. Burd lives in Madison, New Jersey with his wife and two kids
(both in their twenties, and mostly on their own). In his spare time, Dr.
Burd enjoys being a workaholic.

Publisher’s Acknowledgments
We’re proud of this book; please send us your comments at
http://dummies.custhelp.com. For other comments, please contact our
Customer Care Department within the U.S. at 877-762-2974, outside the
U.S. at 317-572-3993, or fax 317-572-4002.
Some of the people who helped bring this book to market include
the following:
Acquisitions and Editorial
Project Editor: Paul Levesque
Acquisitions Editor: Kyle Looper
Copy Editor: Jennifer Riggs
Technical Editor: Brian Buikema
Editorial Manager: Leah Cameron
Editorial Assistant: Amanda Graham
Sr. Editorial Assistant: Cherie Case
Cover Photo: © iStockphoto.com / Cary Westfall
Cartoons: Rich Tennant (www.the5thwave.com)
Composition Services
Project Coordinator: Nikki Gee
Layout and Graphics: Joyce Haughey
Proofreaders: Melissa Cossell, Kathy Simpson
Indexer: BIM Indexing & Proofreading Services
Publishing and Editorial for Technology Dummies
Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary Bednarek, Executive Acquisitions Director
Mary C. Corder, Editorial Director
Publishing for Consumer Dummies
Kathy Nebenhaus, Vice President and Executive Publisher
Composition Services
Debbie Stailey, Director of Composition Services

Table of Contents
Introduction
How to Use This Book
Conventions Used in This Book
What You Don’t Have to Read
Foolish Assumptions
How This Book Is Organized
Book I: Android Jump Start
Book II: Android Background Material
Book III: The Building Blocks
Book IV: Programming Cool Phone Features
Book V: The Job Isn’t Done Until . . .
Book VI: Alternative Android Development
Techniques
More on the Web!
Icons Used in This Book
Where to Go from Here
Book I: Android Jump-Start
Book I: Chapter 1: All about Android
The Consumer Perspective
The Developer Perspective
Java
XML
Linux
The Business Perspective
Book I: Chapter 2: Installing the Software Tools
Installing the Java Development Kit
Java for Windows, Linux, and Solaris
Java for Macintosh
Installing the Android SDK Starter Package
Installing the Eclipse Development
Environment
Downloading Eclipse
Installing Eclipse
Configuring Eclipse
Do I have the Eclipse Android
Development Kit?
Dude, where’s my Android SDK?
Fattening Up the Android SDK
Installing platform tools
Creating an Android Virtual Device
Book I: Chapter 3: Creating an Android App
Creating Your First App
Starting Eclipse
Creating a project
Running your project
What if . . .
Testing Apps on a Real Device
Examining a Basic Android App
A project’s files
The src directory
The gen directory
The res directory
The assets directory
Other files in an Android project
The android.jar archive
The bin directory
Book I: Chapter 4: Conjuring and Embellishing an
Android App
Dragging, Dropping, and Otherwise Tweaking
an App
Creating the “look”
Coding the behavior
A Bit of Debugging
Try it!
More than one way to skin a LogCat
Improving Your App
Improving the layout
Creating a reusable layout
Starting another activity
Localizing your app
Responding to check box events
Displaying images
Sending in your order
Book II: Android Background Material
Book II: Chapter 1: Using the Eclipse Workbench
What’s All That Stuff on the Eclipse
Workbench?
Views and editors
Understanding the big picture
Juggling among perspectives
Changing the way a perspective looks
Where’s my view?
Some Useful Views
Views that normally live in the Java
perspective
Views that normally live in the DDMS
perspective
Be Nice to Your Java Code
Making it pretty
Let Eclipse do the typing
Generating getter and setter methods
Renaming things
Creating Android strings
Using other refactoring actions
The Organize Imports action
Oops!
Some Things You Can Do with Eclipse
Projects
Importing code
Creating a run configuration
Book II: Chapter 2: It’s Java!
From Development to Execution with Java
What is a compiler?
What is a virtual machine?
Grasping Java Code
The Java class
Classes and objects
Java types
The Java method
Objects and their constructors
Classes grow on trees
The Java package
A public class
Other public things
Defying your parent
Java annotations
Java comments
Book II: Chapter 3: What Java Does (and When)
Making Decisions (Java if Statements)
Testing for equality
Choosing among many alternatives (Java
switch statements)
Repeating Instructions Over and Over Again
Java while statements
Java for statements
Java do statements
Arrays in Java
Java’s enhanced for statements
Jumping Away from Trouble
Book II: Chapter 4: Object-Oriented Programming
in Java
Static Fields and Methods
Interfaces and Callbacks
Event handling and callbacks
An object remembers who created it
An easier way to handle an event
Classes That Must (And Must Not) Be
Extended
Java’s final classes
Java’s abstract classes
Inner Classes
Named inner classes
Anonymous inner classes
Book II: Chapter 5: A brief Look at XML
XML Isn’t Ordinary Text
Of tags and elements
Other things you find in an XML
document
What’s in a Namespace?
The package attribute
The style attribute
Book III: The Building Blocks
Book III: Chapter 1: Android Activities
All about Activities
State your intention
The explicit intent
Using a context
The Activity Lifecycle
Lifecycle methods
Taking an activity lifecycle through its paces
Getting Results Back from an Activity
Applications Don’t Feel Left Out
Book III: Chapter 2: Intents and Intent Filters
How to Make a Match
The parts of an intent
The parts of an intent filter
Matching: The general idea using a (silly)
analogy
The real story
Practice, Practice, Practice
No magic
Using a ScrollView
Defining a layout in Java code
Activities and Stacks
The activity stack
Fly the flag
Book III: Chapter 3: Services
A Very Simple Service
The service
A client activity
Services start, stop, and start again
Running a Service at Boot Time
Starting and Binding
Talking about the Weather
A service
A client
Informing the user
Binding to the service
Querying the service
Using shared preferences to restart a
connection
Getting Real Weather Data
Dealing with XML
Getting info from an online server
Talking to a Service as if You’re Right Next
Door
Using AIDL
AIDL and Java code
Book III: Chapter 4: Broadcast Receivers
Receivers 101
Creating a receiver on the fly
Juggling receivers and broadcasts
How to unregister a receiver
Beyond the Fundamentals
Managing receivers
How to be a stickler
Using receiver intents
Ordered broadcasts
Stopping a broadcast in its tracks
Getting results from receivers
Using permissions and other tricks
Standard Broadcasts
Book III: Chapter 5: Content Providers
Databases: From the Stone Age to the Present
Day
Working with a Database
Coding for SQLite using Android’s SDK
Details about the friendly helper class
Details about the mainstream SQLite code
Creating and Using a Content Provider
At last! A content provider!
The latest and greatest cursor code
Book IV: Programming Cool Phone Features
Book IV: Chapter 1: LayOut Your Stuff
Android Layouts
Linear Layout
Attributes (A Detour)
android:layout_width and
android:layout_length
android:padding and android:margin
android:gravity and
android:layout_gravity
android:color
android:visibility
Relative Layout
Table Layout
Frame Layout
Book IV: Chapter 2: Menus, Lists, and Notifications
All about Menus
Creating an Options Menu
Defining the XML file
Handling user actions
Creating a reminder
Putting the new reminder in a list
Creating a Context Menu
Making the context menu appear
Handling context menu item selections
More Stuff about Lists
Creating a list activity
A client for the list activity
Displaying Two (or More) Values in a List
Notifying the User
Notify the user on any device
Notify the user on Honeycomb and
beyond
Book IV: Chapter 3: An Android Potpourri
Making Phone Calls
Two ways to initiate a call
Oops! No phone
On being a dialer
Keep an eye on the phone
Sending a Text Message
Working with Device Sensors
Quantifying location and orientation
Sending location and orientation
Drawing, Dragging, and Zooming
The big picture
The details
On the Importance of Waiting Patiently
Creating an AsyncTask
Using a progress bar
Using an AsyncTask
Book IV: Chapter 4: Apps for Tablets
What Fragments Can Do For You
Programming with fragments
Fragments, more fragments, and even
more fragments
Getting the Best of Both Worlds
Book V: The Job Isn’t Done Until . . .
Book V: Chapter 1: Publishing Your App to the
Android Market
Preparing Your Code
Un-testing the app
Choosing Android versions
Selecting an icon and a label
Set your app’s own version code and
version name
Creating the APK File
Digitally signing your application
Creating a keystore
Safeguarding your keystore
Creating an Android Market Account
Pricing Your Application
The paid model
The free model
Getting Screen Shots for Your Application
Uploading Your Application to the Android
Market
Watching the Installs Soar
Book V: Chapter 2: Publishing Your App to the
Amazon Appstore
Becoming an Amazon Appstore Developer
Uploading an App
Book VI: Alternative Android Development Techniques
Book VI: Chapter 1: Creating Code Quickly with
App Inventor
Getting Started with App Inventor
Creating a Project
Using the Designer
Adding a component to your project
Setting component properties
Arranging screen elements
Using the Blocks Editor
Adding event handlers
Event handlers with parameters
Book VI: Chapter 2: More App Inventor Magic
Snap a Photo
Send a Text Message
Travel to the Orient
Animate!
Make sprites bounce off the edges of the
screen
Make sprites bounce away from each
other
Using a Database
Starting Another Android App
Activities and intents
Starting an activity with App Inventor
Book VI: Chapter 3: How to “Rough It” without
Eclipse
Preliminaries
Your friend, the command window
Scripting
Meet Apache Ant
An Ant’s-eye view
Installing Apache Ant
Getting Ready for Text-Based Development
Preparing your system
Creating a project
Android Development with Ant
Android Development with Operating System
Commands
Book VI: Chapter 4: Going Native
The Native Development Kit
Getting the NDK
Getting a C compiler
Creating an Application
Cheat Sheet

Bookscreen
e-books shop

Introduction
Android phones are everywhere. In January 2011, Android became
the most popular operating system for mobile phones in the United
States.1 In that month, Android’s market share managed to surpass those
of the BlackBerry and the iPhone. And a month later, Android’s presence
grew to include one of every three smartphones in the United States.2
1See
2See
At the same time, Market Force Information, Inc., reported that
“Android appears to be winning the smartphone popularity contest.”3
Among survey respondents in the United States, 34 percent said they
would purchase an Android phone, compared with 21 percent for iPhone
and 12 percent for BlackBerry. On the global scene, research firm Ovum
predicts that by 2016, “We will see dramatic shifts in dominance for
smartphone software platforms, with Android storming into the lead with
38 percent market share.”4
3See 
4See 
So if you read this book in a public place (on a commuter train, at
the beach, on the dance floor at the Coyote Ugly saloon), you can read
proudly, with a chip on your shoulder and with your chest held high.
Android is hot stuff, and you’re cool because you’re reading about it.

How to Use This Book
You can attack this book in either of two ways. You can go cover to
cover, or you can poke around from one chapter to another. You can even
do both (start at the beginning and then jump to a section that particularly
interests you). I designed this book so that the basic topics come first and
the more involved topics follow the basics. But you may already be
comfortable with some basics, or you may have specific goals that don’t
require you to know about certain topics.
In general, my advice is as follows:
• If you already know something, don’t bother reading about it.
• If you’re curious, don’t be afraid to skip ahead. You can always sneak a
peek at an earlier chapter if you really need to do so.

What You Don’t Have to Read
Pick the first chapter or section that has material you don’t already
know and start reading there. Of course, you may hate making decisions
as much as I do. If so, here are some guidelines that you can follow:
• If you’ve already created a simple Android application, and you have all
the right software installed on your computer, skip Book I and go straight
to Book II. Believe me, I won’t mind.
• If you have a modest amount of experience developing Android apps,
and you’re looking for material that puts things together and fills in gaps,
start with Book II.
• If you’re thinking about writing a special kind of app (a text-messaging
app, a location-based app, a game, or something like that), work your way
quickly and impatiently through Books I, II, and III, and dive in seriously
when you reach Book IV.
• If your goal is to publish (and maybe sell) your apps, set Book V as
your ultimate goal. No one can tell you how to become the next Bill
Gates, but Book V gets you thinking about the best ways to share your
Android applications.
If you want to skip the sidebars and the Technical Stuff icons, please
do. In fact, if you want to skip anything at all, feel free.
Loading...
DMCA.com Protection Status