Android in Action Second Edition Frank Ableson download
Android in Action Second Edition Frank Ableson download
pdf download
https://ebookfinal.com/download/android-in-action-second-edition-
frank-ableson/
https://ebookfinal.com/download/ext-js-in-action-second-edition-jesus-
garcia/
https://ebookfinal.com/download/clojure-in-action-second-edition-amit-
rathore-francis-avila/
https://ebookfinal.com/download/social-groups-in-action-and-
interaction-second-edition-edition-stangor/
https://ebookfinal.com/download/endoscopic-ultrasonography-second-
edition-frank-g-gress/
WebWork in Action In Action First Edition Patrick
Lightbody
https://ebookfinal.com/download/webwork-in-action-in-action-first-
edition-patrick-lightbody/
https://ebookfinal.com/download/hello-android-introducing-google-s-
mobile-development-platform-second-edition-burnette-ed/
https://ebookfinal.com/download/android-in-practice-1st-edition-
charlie-collins/
https://ebookfinal.com/download/intellij-idea-in-action-in-action-
series-1st-edition-stephen-saunders/
https://ebookfinal.com/download/scala-in-action-nilanjan-raychaudhuri/
Android in Action Second Edition Frank Ableson Digital
Instant Download
Author(s): Frank Ableson, Robi Sen
ISBN(s): 9781935182726, 1935182722
Edition: Second Edition
File Details: PDF, 13.38 MB
Year: 2011
Language: english
Android in Action
SECOND EDITION
W. FRANK ABLESON
ROBI SEN
CHRIS KING
MANNING
Greenwich
(74° w. long.)
For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
180 Broad St.
Suite 1323
Stamford, CT 06901
Email: [email protected]
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial caps
or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books we publish printed on acid-free paper, and we exert our best efforts to that end.
Recognizing also our responsibility to conserve the resources of our planet, Manning books
are printed on paper that is at least 15 percent recycled and processed without the use of
elemental chlorine
ISBN 978-1-935182-72-6
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – MAL – 16 15 14 13 12 11
brief contents
PART 1 WHAT IS ANDROID?—THE BIG PICTURE ........................1
1 ■ Introducing Android 3
2 ■ Android’s development environment 31
v
vi BRIEF CONTENTS
1 Introducing Android
1.1 The Android platform 4
3
Licensing Android 9
1.3 The layers of Android 10
Building on the Linux kernel 11 ■ Running in the
Dalvik VM 12
1.4 The Intent of Android development 12
Empowering intuitive UIs 13 ■ Intents and how they work 13
vii
viii CONTENTS
3 User interfaces
3.1
63
Creating the Activity
Creating an Activity class
65
66 ■ Exploring the Activity
lifecycle 71
3.2 Working with views 74
Exploring common views 75 Using a ListView 77 ■
activities 108
4.2 Checking the weather with a custom URI 109
Offering a custom URI 109 ■ Inspecting a custom Uri 111
4.3 Checking the weather with broadcast receivers 113
Broadcasting Intent 113 ■ Creating a receiver 115
4.4 Building a background weather service 115
4.5 Communicating with the WeatherAlertService
from other apps 119
Android Interface Definition Language 119 Binder and ■
7 Telephony
7.1
187
Exploring telephony background and terms
Understanding GSM 189 ■ Understanding CDMA
188
189
7.2 Accessing telephony information 190
Retrieving telephony properties 191 ■ Obtaining phone state
information 193
7.3 Interacting with the phone 195
Using intents to make calls 195 Using phone number-related
■
OpenGL ES 241
9.4 Summary 245
10 Multimedia
10.1
246
Introduction to multimedia and OpenCORE 247
10.2 Playing audio 248
10.3 Playing video 250
10.4 Capturing media 251
Understanding the camera 252 ■ Capturing audio 257
10.5 Recording video 259
10.6 Summary 265
code 350
13.3 What time is it? The DayTime Server 352
DayTime Server application 352 daytime.c 353
■
permissions 375
14.2 Interacting with the SensorManager 375
Types of sensors 376 Reading sensor values
■ 377
Enabling and disabling sensors 378
14.3 Building the SenseBot application 379
User interface 380 Interpreting sensor values 382
■
15 Integration
15.1
387
Understanding the Android contact model 388
Choosing open-ended records 388 Dealing with multiple ■
from your app 398 Directly reading and modifying the contacts
■
17 AppWidgets 454
17.1 Introducing the AppWidget 455
What’s an AppWidget? 455 ■ AppWidget deployment
strategies 457
17.2 Introducing SiteMonitor 458
Benefits of SiteMonitor 458 ■ The user experience 459
17.3 SiteMonitor application architecture 462
Bird’s-eye view of the application 462 ■ File by file 464
17.4 AppWidget data handling 465
17.5 Implementing the AppWidgetProvider 469
AppWidgetProvider method inventory 469 Implementing ■
18 Localization
18.1
491
The need for localization 492
18.2 Exploring locales 493
18.3 Strategies for localizing an application 494
Identifying target locales and data 494 Identifying and■
xvii
xviii PREFACE
In addition to the LinkedIn application from chapter 15, two more applications
from this book are available in the Market as free downloads. The first is SenseBot—
an application that allows you to drive a LEGO Mindstorms-powered robot by tilting
your phone. The application demonstrates both the sensor subsystem of Android, as
well as communicating with Bluetooth. The other application available in the Market
is called FindEdges. FindEdges demonstrates the Android Native Development Kit as
it exercises an image processing algorithm written in the C language.
All in all, writing a book for Android is both exciting and challenging. Android
continues to mature and promises to be a major player for years to come. Many thanks
are owed to readers of the first edition, for without you, there wouldn’t be a second
edition!
FRANK ABLESON
preface to the first edition
The first mobile applications I had the opportunity to work with were inventory con-
trol programs used in retail and manufacturing settings. The “terminals,” as we called
them at the time, were heavy and expensive. They had big antennas, lots of clunky
keys, grayscale LCD displays, and they looked like they came straight from the set of a
science fiction movie.
From that austere beginning, my mobile horizons expanded when the Palm Pilot
became the craze in the mid to late 1990s. My first significant PalmOS project was to
develop an IrDA communications library for an application that printed calendars,
contacts, and task-lists. Back then, the hip printers had an IrDA port and it was cool to
beam your business card to someone. Ironically, I always enjoyed designing and writ-
ing the software more than using the devices themselves.
Fast forward ten years, and I have had the privilege of working on some very chal-
lenging and engaging mobile software projects for numerous clients along the way.
Much of my career to date can be traced back to relationships stemming from my
early mobile development experiences—and what a blessing it has been for me. I just
love the question, “would it be possible to…?” And more often than not, the answer
has been “Yes!” What I particularly enjoy is helping change the way a business operates
or the way problems are solved through the application of mobile software. Mobile
technology can and will continue to change the way we live, work, and play…and this
brings me to Android and this book.
In the fall of 2007, I was speaking with my friend Troy Mott, who happens to be an
editor for Manning, the publisher of this book. Troy and I were discussing the mobile
marketplace, something we’ve been doing for years. We started kicking around the
xix
xx PREFACE TO THE FIRST EDITION
idea of writing a book on Android. The challenge was that Android didn’t really exist.
Yet. We knew from some of the preliminary information that the platform promised to
be open, capable, and popular. We felt that those ingredients could make for an inter-
esting and valuable topic, so we began thinking about what that book might look like,
taking it on faith that the platform would actually come to fruition.
Before long, we convinced ourselves (and Manning) that this was a good idea and
the work began in early 2008. Beyond the usual challenges of putting a book together,
we had the additional obstacle that our subject matter has been in a steady, though
unpredictable, state of change over the past year. In essence, we’ve written this book
twice because the SDK has been changed multiple times and Android-equipped
phones have become available, accelerating the interest and demand for the plat-
form. Every time a significant change occurred, we went back and revisited portions of
the book, sometimes rewriting entire chapters to accommodate the latest develop-
ments in the Android platform.
I say “we” because in the process of writing this book, Troy and I decided to share
the fun and brought in two experienced authors to contribute their expertise and
enthusiasm for this platform. It has been a pleasure getting to know and working with
both Charlie Collins and Robi Sen. While I focused on the first and third parts of the
book in the first edition, Charlie and Robi wrote part 2, which covers the important
fundamentals of writing Android applications. Thanks to their contributions, I
enjoyed the freedom to express my vision of what Android means to the mobile space
in the first part of the book, and then to work on a couple of more advanced applica-
tions at the end of the book.
We hope that you enjoy reading this book and that it proves to be a valuable
resource for years to come as together we contribute to the future of the Android
platform.
FRANK ABLESON
acknowledgments
Perhaps the only thing more challenging than writing a technical book is writing the
second edition. There is a lot of excitement when writing the proposed table of con-
tents for the updated edition but at some point the work must commence. The size and
scope of this project meant working together as a team from the start. I had the privi-
lege of working again with Robi Sen from the first edition and also with experienced
developer and writer Chris King. Along with the help of the talented team at Manning,
we are pleased to present Android in Action, the update to Unlocking Android.
In particular, we’d like to acknowledge and thank those at Manning who helped
bring this book about. First, thanks to Troy Mott, our acquisition and development
editor, who has been involved in every aspect of both the first and second editions.
Troy was there from the beginning, from the “what if” stages, through helping push us
over the goal line—twice! Karen Tegtmeyer did all the big and little things to bring
the project together; Mary Piergies skillfully piloted the team through the harrowing
production process; and Marjan Bace, our publisher, showed an attention to detail at
once challenging, beneficial, and appreciated.
Once the writing was done, the next round of work began and special thanks need
to go to: Benjamin Berg who performed the pre-production editing pass, Joan Celmer
and Liz Welch, our copyeditors, who made our content readable in cases where it
went either “too geek” or where the geek in us tried to be “too literary;” Elizabeth
Martin, our proofreader, who added common sense to the project, as well as a terrific
sense of humor and encouraging attitude; Janet Vail who jumped in at the last minute
to help us bring the final pieces of the project together; and finally Dottie Marsico
who handles the actual layout of the pages. It is sometimes hard to envision the final
xxi
Discovering Diverse Content Through
Random Scribd Documents
The Project Gutenberg eBook of Stories
Pictures Tell. Book 8
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
Language: English
By
FLORA L. CARPENTER
Instructor in drawing at Waite High
School, Toledo, Ohio
Formerly supervisor of drawing,
Bloomington, Illinois
Questions about the artist. Who was the first American artist
of note? Where was he born? Of what faith were his parents? Relate
the circumstances which led to Benjamin West’s first drawing, and
the result. How old was he at that time? How did he secure his first
paints? his brushes? What gift did his uncle send him? What became
of Benjamin the day this gift was received? What did his mother
say? Where did he go to study art? In what way did he change art in
England? What school did he establish? Name five other American
artists, and tell why they are famous.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com