Android Recipes_ A Problem-Solution Approach (4th ed.) [Smith 2015-01-30](1).pdf
(
6378 KB
)
Pobierz
Hundreds of problems and solutions of code recipes
using Android 5.0
Android
Recipes
FOURTH EDITION
A Problem-Solution Approach
Dave Smith
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
Contents at a Glance
About the Author �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½xxi
About the Technical Reviewer �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½xxiii
Acknowledgments �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½xxv
Introduction �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½xxvii
■
Chapter 1: Layouts and Views �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
1
■
Chapter 2: User Interaction Recipes �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
89
■
Chapter 3: Communications and Networking �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
199
■
Chapter 4: Interacting with Device Hardware and Media �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
289
■
Chapter 5: Persisting Data �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
391
■
Chapter 6: Interacting with the System�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
471
■
Chapter 7: Graphics and Drawing �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
613
■
Chapter 8: Working with Android NDK and RenderScript �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
689
Index �½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½�½
737
iii
Introduction
Welcome to the fourth edition of
Android Recipes!
If you are reading this book, you probably don’t need to be told of the immense opportunity
that mobile devices represent for software developers and users. In recent years, Android
has become one of the top mobile platforms for device users. This means that you, as a
developer, must know how to harness Android so you can stay connected to this market
and the potential that it offers. But any new platform brings with it uncertainty about best
practices and solutions to common needs and problems.
What we aim to do with
Android Recipes
is give you the tools to write applications for the
Android platform through direct examples targeted at the specific problems you are trying
to solve. This book is not a deep dive into the Android SDK, NDK, or any of the other tools.
We don’t weigh you down with all the details and theory behind the curtain. That’s not to
say that those details aren’t interesting or important. You should take the time to learn them,
as they may save you from making future mistakes. However, more often than not, they are
simply a distraction when you are just looking for a solution to an immediate problem.
This book is not meant to teach you Java programming or even the building blocks of an
Android application. You won’t find many basic recipes in this book (such as how to display
text with
TextView,
for instance), as we feel these are tasks easily remembered once learned.
Instead, we set out to address tasks that developers, once comfortable with Android, need
to do often but find too complex to accomplish with a few lines of code.
Treat
Android Recipes
as a reference to consult, a resource-filled cookbook that you can
always open to find the pragmatic advice you need to get the job done quickly and well.
xxvii
xxviii
Introduction
What Will You Find in the Book?
We dive into using the Android SDK to solve real problems. You will learn tricks for effectively
creating a user interface that runs well across device boundaries. You will become a master
at incorporating the collection of hardware (radios, sensors, and cameras) that makes
mobile devices unique platforms. We’ll even discuss how to make the system work for you
by integrating with the services and applications provided by Google and various device
manufacturers.
Performance matters if you want your applications to succeed. Most of the time, this isn’t
a problem because the Android runtime engines get progressively better at compiling
bytecode into the device’s native code. However, you might need to leverage the Android
NDK to boost performance. Chapter 8 offers you an introduction to the NDK and integrating
native code into your application using Java Native Interface (JNI) bindings.
The NDK is a complex technology, which can also reduce your application’s portability.
Also, while good at increasing performance, the NDK doesn’t address multicore processing
very well for heavy workloads. Fortunately, Google has eliminated this tedium and simplified
the execute-on-multiple-cores task while achieving portability by introducing RenderScript.
Chapter 8 introduces you to RenderScript and shows you how to use its compute engine
(and automatically leverage CPU cores) to process images.
Keep a Level Eye on the Target
Throughout the book, you will see that we have marked most recipes with the minimum API
level that is required to support them. Most of the recipes in this book are marked API Level 1,
meaning that the code used can be run in applications targeting any version of Android
since 1.0. However, where necessary, we use APIs introduced in later versions. Pay close
attention to the API level marking of each recipe to ensure that you are not using code that
doesn’t match up with the version of Android your application is targeted to support.
Plik z chomika:
musli_com
Inne pliki z tego folderu:
100 Questions and Answers to Help You Land Your Dream Android Job_ or to Hire the Right Candidate! [López-Mañas 2015-07-19](1).pdf
(742 KB)
20 Recipes for Programming PhoneGap_ Cross-Platform Mobile Development for Android and iPhone [Munro 2012-04-06](1).pdf
(6551 KB)
50 Android Hacks [Sessa 2013-06-13](2).pdf
(10631 KB)
A Guide to Android for Seniors_ Introduction to Android Phones and Tablets [Hollinder 2015-04-02](1).pdf
(336 KB)
Advanced Android 4 Games [Silva 2011-12-19](1).pdf
(7341 KB)
Inne foldery tego chomika:
3D Design - Programming
ActionScript
Actionscript - Flash - Flex - Air
Ada
ADO
Zgłoś jeśli
naruszono regulamin