The Busy Coder's Guide to Android Development

The Busy Coder's Guide to Android Development

Version 2.9 Supports the Android 2.1 SDK! The Busy Coder's Guide to Android Development Mark L. Murphy COMMONSWARE The Busy Coder's Guide to Android Development by Mark L. Murphy Subscribe to updates at http://commonsware.com Special Creative Commons BY-SA 3.0 License Edition The Busy Coder's Guide to Android Development by Mark L. Murphy Copyright © 2008-2010 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 [email protected]. Printing History: Jan 2010: Version 2.9 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-SA 3.0 License Edition Table of Contents Welcome to the Warescription!.........................................................xvii Preface..................................................................................................xix Welcome to the Book!...............................................................................xix Prerequisites...............................................................................................xix Warescription.............................................................................................xx Book Bug Bounty.......................................................................................xxi Source Code And Its License...................................................................xxii Creative Commons and the Four-to-Free (42F) Guarantee..................xxii Acknowledgments...................................................................................xxiii The Big Picture.........................................................................................1 What Androids Are Made Of.......................................................................3 Activities.................................................................................................3 Content Providers..................................................................................4 Services...................................................................................................4 Intents.....................................................................................................4 Stuff At Your Disposal..................................................................................4 Storage....................................................................................................4 Network...................................................................................................5 Multimedia.............................................................................................5 iii Subscribe to updates at http://commonsware.com Special Creative Commons BY-SA 3.0 License Edition GPS..........................................................................................................5 Phone Services........................................................................................5 Projects and Targets................................................................................7 Pieces and Parts............................................................................................7 Creating a Project.........................................................................................8 Project Structure...........................................................................................9 Root Contents........................................................................................9 The Sweat Off Your Brow.....................................................................10 And Now, The Rest of the Story..........................................................10 What You Get Out Of It........................................................................11 Inside the Manifest......................................................................................11 In The Beginning, There Was the Root, And It Was Good...............12 Permissions, Instrumentations, and Applications (Oh, My!)...........13 Your Application Does Something, Right?.........................................14 Achieving the Minimum......................................................................15 Version=Control...................................................................................16 Emulators and Targets................................................................................17 Virtually There......................................................................................17 Aiming at a Target................................................................................19 Creating a Skeleton Application...........................................................23 Begin at the Beginning...............................................................................23 The Activity.................................................................................................24 Dissecting the Activity...............................................................................25 Building and Running the Activity...........................................................26 Using XML-Based Layouts.....................................................................31 What Is an XML-Based Layout?.................................................................31 Why Use XML-Based Layouts?..................................................................32 iv Subscribe to updates at http://commonsware.com Special Creative Commons BY-SA 3.0 License Edition OK, So What Does It Look Like?...............................................................33 What's With the @ Signs?..........................................................................34 And We Attach These to the Java...How?.................................................34 The Rest of the Story..................................................................................35 Employing Basic Widgets......................................................................39 Assigning Labels.........................................................................................39 Button, Button, Who's Got the Button?...................................................40 Fleeting Images...........................................................................................41 Fields of Green. Or Other Colors..............................................................43 Just Another Box to Check.........................................................................45 Turn the Radio Up......................................................................................48 It's Quite a View.........................................................................................50 Useful Properties..................................................................................50 Useful Methods....................................................................................50 Colors.....................................................................................................51 Working with Containers......................................................................53 Thinking Linearly.......................................................................................54 Concepts and Properties......................................................................54 Example.................................................................................................58 All Things Are Relative...............................................................................63 Concepts and Properties......................................................................63 Example................................................................................................66 Tabula Rasa.................................................................................................69 Concepts and Properties.....................................................................69 Example.................................................................................................72 Scrollwork....................................................................................................73 v Subscribe to updates at http://commonsware.com Special Creative Commons BY-SA 3.0 License Edition Using Selection Widgets........................................................................77 Adapting to the Circumstances.................................................................77 Using ArrayAdapter.............................................................................78 Other Key Adapters.............................................................................79 Lists of Naughty and Nice..........................................................................79 Selection Modes....................................................................................81 Spin Control................................................................................................83 Grid Your Lions (Or Something Like That...)..........................................87 Fields: Now With 35% Less Typing!..........................................................91

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    533 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us