The Busy Coder's Guide to Android
Enviado por alexym • 31 de Agosto de 2011 • 4.789 Palabras (20 Páginas) • 817 Visitas
The Busy Coder's Guide to Android
Development
by Mark L. Murphy
The Busy Coder's Guide to Android Development
by Mark L. Murphy
Copyright © 2008 CommonsWare, LLC. All Rights Reserved.
Printed in the United States of America.
CommonsWare books may be purchased in printed (bulk) or digital form for educational or
business use. For more information, contact direct@commonsware.com.
Printing History:
Jul 2008: Version 1.0 ISBN: 978-0-9816780-0-9
The CommonsWare name and logo, “Busy Coder's Guide”, and related trade dress are
trademarks of CommonsWare, LLC.
All other trademarks referenced in this book are trademarks of their respective firms.
The publisher and author(s) assume no responsibility for errors or omissions or for damages
resulting from the use of the information contained herein.
Subscribe to updates at http://commonsware.com Special Creative Commons BY-NC-SA 3.0 License Edition
Table of Contents
Welcome to the Warescription!..................................................................................xiii
Preface.........................................................................................................................xv
Welcome to the Book!...........................................................................................................xv
Prerequisites.........................................................................................................................xv
Warescription......................................................................................................................xvi
Book Bug Bounty.................................................................................................................xvii
Source Code License..........................................................................................................xviii
Creative Commons and the Four-to-Free (42F) Guarantee............................................xviii
The Big Picture................................................................................................................1
What Androids Are Made Of.................................................................................................3
Activities..........................................................................................................................3
Content Providers...........................................................................................................4
Intents.............................................................................................................................4
Services............................................................................................................................4
Stuff At Your Disposal.............................................................................................................5
Storage.............................................................................................................................5
Network...........................................................................................................................5
Multimedia......................................................................................................................5
GPS..................................................................................................................................5
Phone Services.................................................................................................................6
Project Structure............................................................................................................7
Root Contents.........................................................................................................................7
The Sweat Off Your Brow.......................................................................................................8
iii
Subscribe to updates at http://commonsware.com Special Creative Commons BY-NC-SA 3.0 License Edition
And Now, The Rest of the Story.............................................................................................8
What You Get Out Of It.........................................................................................................9
Inside the Manifest........................................................................................................11
In The Beginning, There Was the Root, And It Was Good.................................................11
Permissions, Instrumentations, and Applications (Oh, My!).............................................12
Your Application Does Something, Right?..........................................................................13
Creating a Skeleton Application...................................................................................17
Begin at the Beginning...........................................................................................................17
The Activity...........................................................................................................................18
Dissecting the Activity...........................................................................................................19
Building and Running the Activity.......................................................................................21
Using XML-Based Layouts............................................................................................23
What Is an XML-Based Layout?...........................................................................................23
Why Use XML-Based Layouts?............................................................................................24
OK, So What Does It Look Like?..........................................................................................25
What's With the @ Signs?....................................................................................................26
And We Attach These to the Java...How?...........................................................................26
The Rest of the Story.............................................................................................................27
Employing Basic Widgets.............................................................................................29
Assigning Labels....................................................................................................................29
...