Sams Teach Yourself Android Application Development in 24 Hours docx

512 2,797 0
  • Loading ...
1/512 trang
Tải xuống

Thông tin tài liệu

Ngày đăng: 15/03/2014, 10:20 Teach YourselfAndroid™Application Development800 East 96th Street, Indianapolis, Indiana, 46240 USALauren DarceyShane ConderSecond Teach Yourself Android Application Development in 24 Hours,Second EditionCopyright © 2012 by Lauren Darcey and Shane ConderAll rights reserved. No part of this book shall be reproduced, stored in a retrieval system, ortransmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, withoutwritten permission from the publisher. No patent liability is assumed with respect to the use ofthe information contained herein. Although every precaution has been taken in the preparation ofthis book, the publisher and author assume no responsibility for errors or omissions. Nor is anyliability assumed for damages resulting from the use of the information contained herein.ISBN-13: 978-0-672-33569-3ISBN-10: 0-672-33569-7Library of Congress Cataloging-in-Publication DataDarcey, Lauren, 1977-Sams teach yourself Android application development in 24 hours /Lauren Darcey, Shane Conder. 2nd ed.p. cm.ISBN 978-0-672-33569-3 (pbk. : alk. paper)1. Application software Development. 2. Android (Electronicresource) 3. Mobile computing. I. Conder, Shane, 1975- II. Title. III.Title: Teach yourself Android application development in twenty-fourhours. QA76.76.A65D26 2012004 dc232011025487Printed in the United States of AmericaFirst Printing August 2011TrademarksAll terms mentioned in this book that are known to be trademarks or service marks have beenappropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Useof a term in this book should not be regarded as affecting the validity of any trademark or servicemark.Warning and DisclaimerEvery effort has been made to make this book as complete and as accurate as possible, but nowarranty or fitness is implied. The information provided is on an “as is” basis. The authors andthe publisher shall have neither liability nor responsibility to any person or entity with respect toany loss or damages arising from the information contained in this book.Bulk SalesSams Publishing offers excellent discounts on this book when ordered in quantity for bulk pur-chases or special sales. For more information, please contactU.S. Corporate and Government Sales1-800-382-3419corpsales@pearsontechgroup.comFor sales outside of the U.S., please contactInternational Salesinternational@pearson.comEditor in ChiefMark TaubAcquisitions EditorTrina MacDonaldDevelopmentEditorSheri CainManaging EditorSandra SchroederProject EditorMandie FrankCopy EditorCharlotte Kughen,The WordsmitheryLLCIndexerLarry SweazyProofreaderWilliams WoodsPublishing ServicesTechnical EditorJim HathawayPublishingCoordinatorOlivia BasegioDesignerGary AdairCompositorBronkella at a GlanceIntroduction 1Part I: Android FundamentalsHOUR 1 Getting Started with Android 92 Mastering the Android Development Tools 313 Building Android Applications 474 Managing Application Resources 655 Configuring the Android Manifest File 836 Designing an Application Framework 99Part II: Building an Application Framework HOUR 7 Implementing an Animated Splash Screen 1178 Implementing the Main Menu Screen 1339 Developing the Help and Scores Screens 15110 Building Forms to Collect User Input 17111 Using Dialogs to Collect User Input 18912 Adding Application Logic 205Part III: Enhancing Your Application with Powerful Android FeaturesHOUR 13 Working with Images and the Camera 22714 Adding Support for Location-Based Services 24515 Adding Basic Network Support 26916 Adding Additional Network Features 29317 Adding Social Features 30918 Creating a Home Screen App Widget 325Part IV: Adding Polish to Your Android Application 19 Internationalizing Your Application 34120 Developing for Different Devices Diving Deeper into Android 37122 Testing Android Applications 391Part V: Publishing Your Application HOUR 23 Getting Ready to Publish 40924 Publishing on the Android Market 421Part VI: Appendixes A Configuring Your Android Development Environment 437B Eclipse IDE Tips and Tricks 445C Supplementary Materials 453Index 459ivSams Teach Yourself Android Application Development in 24 Hours, Second of ContentsIntroduction 1Who Should Read This Book? 2How This Book Is Structured 3What Is (and Isn’t) in This Book 4What Development Environment Is Used? 5What Conventions Are Used in This Book? 5An Overview of Changes in This Edition 6About the Short Links 7Supplementary Tools Available 8Part I: Android FundamentalsHOUR 1: Getting Started with Android 9Introducing Android 9Google and the Open Handset Alliance 9Android Makes Its Entrance 10Cheap and Easy Development 11Familiarizing Yourself with Eclipse 13Creating Android Projects 14Exploring the Android Project Files 16Editing Project Resources 17Running and Debugging Applications 21Managing Android Virtual Devices 21Creating Debug and Run Configurations in Eclipse 22Launching Android Applications Using the Emulator 24Debugging Android Applications Using DDMS 25Launching Android Applications on a Device Teach Yourself Android Application Development in 24 Hours, Second EditionHOUR 2: Mastering the Android Development Tools 31Using the Android Documentation 31Debugging Applications with DDMS 33Managing Tasks 34Browsing the Android File System 35Interacting with Emulators 36Taking Screenshots of the Emulator or Handset 38Viewing Log Information 39Working with the Android Emulator 39Providing Input to the Emulator 40Exploring the Android System 40Using SD Card Images with the Emulator 42Using Other Android Tools 43HOUR 3: Building Android Applications 47Designing a Typical Android Application 47Designing Application Features 48Determining Application Activity Requirements 49Implementing Application Functionality 50Using the Application Context 51Retrieving Application Resources 51Accessing Application Preferences 51Accessing Other Application Functionality Using Contexts 52Working with Activities 52Launching Activities 53Managing Activity State 54Shutting Down Activities 56Working with Intents 56Passing Information with Intents 56Using Intents to Launch Other Applications 57Working with Dialogs 58Working with Fragments 59Logging Application Information 4: Managing Application Resources 65Using Application and System Resources 65Working with Application Resources 66Working with System Resources 68Working with Simple Resource Values 69Working with Strings 69Working with Colors 70Working with Dimensions 71Working with Drawable Resources 72Working with Images 72Working with Other Types of Drawables 73Working with Layouts 74Designing Layouts Using the Layout Resource Editor 74Designing Layouts Using XML 75Working with Files 77Working with XML Files 77Working with Raw Files 78Working with Other Types of Resources 79HOUR 5: Configuring the Android Manifest File 83Exploring the Android Manifest File 83Using the Manifest Tab 84Using the Application Tab 84Using the Permissions Tab 85Using the Instrumentation Tab 86Using the AndroidManifest.xml Tab 86Configuring Basic Application Settings 87Naming Android Packages 88Versioning an Application 88Setting the Minimum Android SDK Version 89Naming an Application 90Providing an Icon for an Application an Application Description 90Setting Debug Information for an Application 90Setting Other Application Attributes 90Defining Activities 91Registering Activities 91Designating the Launch Activity 92Managing Application Permissions 93Managing Other Application Settings 96HOUR 6: Designing an Application Framework 99Designing an Android Trivia Game 99Determining High-Level Game Features 100Determining Activity Requirements 100Determining Screen-Specific Game Features 101Implementing an Application Prototype 106Reviewing the Accompanying Source Code 106Creating a New Android Project 107Adding Project Resources 107Implementing Application Activities 109Creating Application Preferences 110Running the Game Prototype 111Creating a Debug Configuration 112Launching the Prototype in the Emulator 112Exploring the Prototype Installation 113Part II: Building an Application Framework HOUR 7: Implementing an Animated Splash Screen 117Designing the Splash Screen 117Implementing the Splash Screen Layout 118Adding New Project Resources 120Updating the Splash Screen Layout 122viiiSams Teach Yourself Android Application Development in 24 Hours, Second with Animation 126Adding Animation Resources 126Animating Specific Views 128Animating All Views in a Layout 129Handling Animation Life Cycle Events 129HOUR 8: Implementing the Main Menu Screen 133Designing the Main Menu Screen 133Determining Main Menu Screen Layout Requirements 134Designing the Screen Header with RelativeLayout 135Designing the ListView Control 135Finishing Touches for the Main Menu Layout Design 135Implementing the Main Menu Screen Layout 136Adding New Project Resources 136Updating the Main Menu Screen Layout Files 138Working with the ListView Control 140Filling a ListView Control 140Listening for ListView Events 141Customizing ListView Control Characteristics 143Working with Other Menu Types 144Adding an Options Menu to the Game Screen 145HOUR 9: Developing the Help and Scores Screens 151Designing the Help Screen 151Implementing the Help Screen Layout 153Adding New Project Resources 153Updating the Help Screen Layout 154Working with Files 155Adding Raw Resource Files 156Accessing Raw File Resources[...]... 429 Selling Your Application on Your Own Site 429 Selling Your Application on Other Markets 430 xviii Sams Teach Yourself Android Application Development in 24 Hours, Second Edition Part VI: Appendixes APPENDIX A : Configuring Your Android Development Environment 437 Development Machine Prerequisites... applications, including how Android applications are structured and configured, as well as how to incorporate application resources such as strings, graphics, and user interface components into your projects Part II, “Building an Application Framework” In this part, you begin developing an application framework that serves as the primary teaching-tool for the rest of the book You start by developing an animated... 293 Keeping Player Data in Sync 294 Uploading Settings Data to a Remote Server 295 xiv Sams Teach Yourself Android Application Development in 24 Hours, Second Edition Working with Android Services Implementing UploadTask ... robot shown in Figure 1.1 Introducing Android 11 FIGURE 1.1 The Android mascot Although most Android applications are written in Java, developers do have other options for targeting apps for Android devices Specifically, developers can design web applications for the Android platform using HTML5 and JavaScript and they can use the Android Native Development Kit (NDK) to include C/C++... : Working with Images and the Camera Designing the Avatar Feature 227 227 Adding an Avatar to the Settings Layout 229 Updating the Settings Screen Layout 230 xii Sams Teach Yourself Android Application Development in 24 Hours, ... variety of Android topics as well as reader discussions, questions, clarifications, the occasional exercise walkthrough, and lots of other information about Android development You can also find links to their various technical articles online and in print HOUR 1 Getting Started with Android What You’ll Learn in This Hour: A brief history of the Android platform Familiarizing yourself. .. newly introduced Android concepts, and you iteratively improve your application from hour to hour This book is divided into six parts: Part I, Android Fundamentals”—Here, you get an introduction to Android, become familiar with the Android SDK and tools, install the development tools, and write your first Android application Part I also introduces the design principles necessary to write Android applications,... book the most painless way possible to get started developing Android applications Finally, we included many additions, clarifications, and, yes, even a few fixes based upon the feedback from our fantastic (and meticulous) readers Thank you! About the Short Links We’ve chosen to make most links in the book short links This benefits the readers of the print book by making typing links in far easier and... 374 Working with Input Methods 374 xvi Sams Teach Yourself Android Application Development in 24 Hours, Second Edition Handling User Gestures 375 Converting Text to Speech 376 Converting Speech to Text... 440 Installing and Configuring the Android Plug -in for Eclipse (ADT) Configuring Development Hardware for Device Debugging 440 443 Configuring Android Devices for Development Purposes 443 Configuring Your Operating System for Device Debugging 443 APPENDIX B : Eclipse IDE Tips and Tricks Creating New Classes and Methods . DarceyShane ConderSecond Edition 24 in Hours Sams Teach Yourself Android Application Development in 24 Hours, Second EditionCopyright. Sams Teach Yourself Android Application Development in 24 Hours, Second EditionHOUR 2: Mastering the Android Development
- Xem thêm -

Xem thêm: Sams Teach Yourself Android Application Development in 24 Hours docx, Sams Teach Yourself Android Application Development in 24 Hours docx, Sams Teach Yourself Android Application Development in 24 Hours docx

Từ khóa liên quan

Mục lục

Xem thêm

Gợi ý tài liệu liên quan cho bạn