Android Application Development_ Program - Rogers_ Rick.pdf

(4427 KB) Pobierz
262147313 UNPDF
262147313.017.png
262147313.018.png
Android Application Development
Rick Rogers, John Lombardo, Zigurd Mednieks, and Blake
Meike
Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo
262147313.019.png 262147313.020.png 262147313.001.png 262147313.002.png 262147313.003.png 262147313.004.png 262147313.005.png
Android Application Development
by Rick Rogers, John Lombardo, Zigurd Mednieks, and Blake Meike
Copyright © 2009 Rick Rogers, John Lombardo, Zigurd Mednieks, and Blake Meike. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles ( http://mysafaribooksonline.com ). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com .
Editor: Andy Oram
Production Editor: Sumita Mukherji
Copyeditor: Genevieve d’Entremont
Proofreader: Sada Preisch
Indexer: Joe Wizda
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Robert Romano
Printing History:
May 2009:
First Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Android Application Development , the image of an Eastern quoll and related trade
dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
TM
This book uses RepKover™, a durable and flexible lay-flat binding.
ISBN: 978-0-596-52147-9
[M]
1241533714
262147313.006.png 262147313.007.png 262147313.008.png 262147313.009.png 262147313.010.png
 
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Part I. Development Kit Walk-Through
1. Getting to Know Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Why Android?
3
The Open Handset Alliance
4
The Android Execution Environment
5
Components of an Android Application
6
Android Activity Lifecycle
8
Android Service Lifecycle
10
How This Book Fits Together
10
2. Setting Up Your Android Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . 13
Setting Up Your Development Environment
13
Creating an Android Development Environment
14
Hello, Android
18
Where We’re Going
18
Starting a New Android Application: HelloWorld
18
Writing HelloWorld
22
Running HelloWorld
24
3. Using the Android Development Environment for Real Applications . . . . . . . . . . . . 27
MicroJobs: This Book’s Main Sample Application
27
Android and Social Networking
27
Downloading the MJAndroid Code
30
A Brief Tour of the MJAndroid Code
30
The Project Root Folder (MJAndroid)
30
The Source Folder (src)
31
The Resource Folder (res)
32
First Steps: Building and Running the MicroJobs Application
33
iii
262147313.011.png 262147313.012.png 262147313.013.png 262147313.014.png 262147313.015.png 262147313.016.png
Zgłoś jeśli naruszono regulamin