sams teach yourself android application development in 24 hours 7summits

475 966 0
sams teach yourself android application development in 24 hours 7summits

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

ptg ptg 800 East 96th Street, Indianapolis, Indiana 46240 USA Lauren Darcey Shane Conder Sams Teach Yourself 24 in Hours AndroidApplication Development ptg Sams Teach Yourself Android™ Application Development in 24 Hours Copyright © 2010 Lauren Darcey and Shane Conder All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. Visible Earth images owned by NASA, http://visibleearth.nasa.gov/. ISBN-13: 978-0-321-67335-0 ISBN-10: 0-321-67335-2 Library of Congress Cataloging-in-Publication Data Darcey, Lauren, 1977- Sams teach yourself Android application development in 24 hours / Lauren Darcey, Shane Conder. p. cm. — (Sams teach yourself in 24 Hours) Includes index. ISBN 978-0-321-67335-0 (pbk.) 1. Application software—Development. 2. Android (Electronic resource) 3. Mobile computing. I. Conder, Shane, 1975- II. Title. QA76.76.A65D26 2010 005.1—dc22 2010011663 Printed in the United States of America First Printing June 2010 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an “as is” basis. The authors and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the programs accompanying it. Bulk Sales Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk pur- chases or special sales. For more information, please contact U.S. Corporate and Government Sales 1-800-382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact International Sales international@pearson.com Editor-in-Chief Mark Taub Acquisitions Editor Trina MacDonald Development Editor Michael Thurston Managing Editor Kristy Hart Project Editor Betsy Harris Copy Editor Kitty Wilson Indexer Erika Millen Proofreader Sheri Cain Technical Editor Jonathan Jackson Publishing Coordinator Olivia Basegio Book Designer Gary Adair Senior Compositor Gloria Schurick ptg Contents at a Glance Introduction. 1 Part I: Android Fundamentals HOUR 1 Getting Started with Android . 7 2 Mastering the Android Development Tools . 27 3 Building Android Applications . 43 4 Managing Application Resources 59 5 Configuring the Android Manifest File. 77 6 Designing an Application Framework. 95 Part II: Building an Application Framework HOUR 7 Implementing an Animated Splash Screen 113 8 Implementing the Main Menu Screen . 127 9 Developing the Help and Scores Screens . 143 10 Building Forms to Collect User Input. 161 11 Using Dialogs to Collect User Input . 181 12 Adding Application Logic . 197 Part III: Enhancing Your Application with Powerful Android Features HOUR 13 Working with Images and the Camera 217 14 Adding Support for Location-Based Services . 233 15 Adding Network Support . 255 16 Adding More Network Support 277 17 Adding Social Features . 291 18 Creating a Home Screen App Widget . 305 Part IV: Adding Polish to Your Android Application HOUR 19 Internationalizing Your Application . 321 20 Developing for Different Devices 333 21 Diving Deeper into Android 347 22 Testing Android Applications . 367 ptg iv Teach Yourself Android Application Development in 24 Hours Part V: Publishing Your Application HOUR 23 Getting Ready to Publish . 383 24 Publishing on the Android Market 395 Part VI: Appendixes A Configuring Your Android Development Environment 409 B Eclipse IDE Tips and Tricks . 415 C Supplementary Materials. 423 ptg Table of Contents Introduction 1 Part I: Android Fundamentals HOUR 1: Getting Started with Android 7 Introducing Android . 7 Familiarizing Yourself with Eclipse 9 Running and Debugging Applications . 17 Summary . 23 Q&A. 23 Workshop 24 HOUR 2: Mastering the Android Development Tools 27 Using the Android Documentation . 27 Debugging Applications with DDMS . 29 Working with the Android Emulator . 35 Using Other Android Tools . 38 Summary . 39 Q&A. 40 Workshop 40 HOUR 3: Building Android Applications 43 Designing a Typical Android Application . 43 Using the Application Context . 46 Working with Activities . 47 Working with Intents 51 Working with Dialogs . 53 Logging Application Information . 54 Summary . 55 Q&A. 55 Workshop 56 v ptg HOUR 4: Managing Application Resources 59 Using Application and System Resources . 59 Working with Simple Resource Values . 63 Working with Drawable Resources . 66 Working with Layouts 67 Working with Files . 71 Working with Other Types of Resources . 73 Summary . 73 Q&A. 74 Workshop 75 HOUR 5: Configuring the Android Manifest File 77 Exploring the Android Manifest File 77 Configuring Basic Application Settings . 81 Defining Activities . 86 Managing Application Permissions 88 Managing Other Application Settings . 91 Summary . 91 Q&A. 92 Workshop 93 HOUR 6: Designing an Application Framework 95 Designing an Android Trivia Game 95 Implementing an Application Prototype . 102 Running the Game Prototype . 107 Summary 109 Q&A 110 Workshop . 110 vi Teach Yourself Android Application Development in 24 Hours ptg Part II: Building an Application Framework HOUR 7: Implementing an Animated Splash Screen 113 Designing the Splash Screen . 113 Implementing the Splash Screen Layout . 114 Working with Animation . 119 Summary 123 Q&A 124 Workshop . 124 HOUR 8: Implementing the Main Menu Screen 127 Designing the Main Menu Screen 127 Implementing the Main Menu Screen Layout 131 Working with the ListView Control 134 Working with Other Menu Types . 138 Summary 141 Q&A 141 Workshop . 141 HOUR 9: Developing the Help and Scores Screens 143 Designing the Help Screen 144 Implementing the Help Screen Layout 145 Working with Files. 147 Designing the Scores Screen . 149 Implementing the Scores Screen Layout . 151 Designing a Screen with Tabs . 154 Working with XML 156 Summary 158 Q&A 158 Workshop . 159 Contents vii ptg HOUR 10: Building Forms to Collect User Input 161 Designing the Settings Screen . 161 Implementing the Settings Screen Layout 165 Using Common Form Controls 167 Saving Form Data with SharedPreferences 175 Summary 178 Q&A 178 Workshop . 179 HOUR 11: Using Dialogs to Collect User Input 181 Working with Activity Dialogs . 181 Using DatePickerDialog . 184 Working with Custom Dialogs . 187 Summary 194 Q&A 194 Workshop . 194 HOUR 12: Adding Application Logic 197 Designing the Game Screen . 197 Implementing the Game Screen Layout . 200 Working with ViewSwitcher Controls . 203 Wiring Up Game Logic. 208 Summary 214 Q&A 215 Workshop . 215 Part III: Enhancing Your Application with Powerful Android Features HOUR 13: Working with Images and the Camera 217 Designing the Avatar Feature . 217 Adding an Avatar to the Settings Screen Layout . 219 Working with ImageButton Controls . 221 Working with Image Media . 223 viii Teach Yourself Android Application Development in 24 Hours ptg Working with Bitmaps . 228 Summary 230 Q&A 230 Workshop . 231 HOUR 14: Adding Support for Location-Based Services 233 Designing the Favorite Place Feature . 233 Implementing the Framework for the Favorite Place Feature . 237 Using Location-Based Services . 240 Using Geocoding Services . 246 Working with Maps 248 Summary 251 Q&A 251 Workshop . 252 HOUR 15: Adding Network Support 255 Designing Network Applications . 255 Developing Network Applications 257 Accessing Network Services 260 Indicating Network Activity with Progress Bars . 262 Running Tasks Asynchronously 265 Downloading and Displaying Scores . 267 Downloading and Parsing Question Batches . 271 Summary 274 Q&A 274 Workshop . 274 HOUR 16: Adding More Network Support 277 Determining Data to Send to the Server . 277 Accessing Phone Status Information. 278 Uploading Data to a Remote Application Server 281 Summary 289 Q&A 289 Workshop . 289 Contents ix [...]... your first Android application Part I also introduces the design principles necessary to write Android 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 Part II, you’ll begin developing an application. .. android: versionName=”1.0”> < /application> Familiarizing Yourself. .. projects are discussed in detail in Hour 22, “Testing Android Applications.” 11 Click the Finish button 11 12 HOUR 1: Getting Started with Android FIGURE 1.2 The Android Project Wizard in Eclipse Exploring the Android Project Files You will now see a new Android project called Droid1 in the Eclipse File Explorer In addition to linking the appropriate Android SDK jar file, the following core files and directories... 385 Testing the Application Release Candidate 386 Packaging and Signing an Application 387 Testing the Signed Application Package 390 Summary 392 Q&A 392 Workshop 393 xii Teach Yourself Android Application Development in 24 Hours HOUR 24: Publishing on the Android Market Selling on the Android Market 395... deployment Installing the Android SDK and Tools You will find all the details of how to install and configure your computer for Android application development in Appendix A, “Configuring Your Android Development Environment.” You will need to install and configure Eclipse, the Android SDK, and the ADT plug -in for Eclipse You may also need to install the USB drivers for any Android handsets you will be using... more about project resources in Hour 4, “Managing Application Resources.” For now, let’s move on to compiling and running the application Running and Debugging Applications Running and Debugging Applications To build and debug an Android application, you must first configure your project for debugging The ADT plug -in enables you to do this entirely within the Eclipse development environment Specifically,... electronics running Android The rate of new Android devices reaching the world markets has continued to increase In the United States, all major carriers now include Android phones in their product lines Google has been a contributing member of the Open Handset Alliance from the beginning The company hosts the Android open source project as well as the Android developer program at http://developer .android. com... project files Android- specific resource editors The Android SDK and AVD (Android Virtual Devices) Manager 9 10 HOUR 1: Getting Started with Android The Eclipse DDMS perspective for monitoring and debugging Android applications Integration with Android LogCat logging Automated builds and application deployment to Android emulators and handsets Application packaging and code signing tools for release...x Teach Yourself Android Application Development in 24 Hours HOUR 17: Adding Social Features 291 Enhancing Your Application with Social Features 291 Adding Friend Support to Your Application 292 Integrating with Social Networking Services 300 Summary 302 Q&A 302 Workshop 303 HOUR 18: Creating a Home... costs to developing Android applications The Android SDK and tools are freely available on the Android developer website, http://developer .android. com The freely available Eclipse program has become the most popular integrated development environment (IDE) for Android application development; there is also a powerful plug -in available on the Android developer site for facilitating Android development So . Street, Indianapolis, Indiana 4 6240 USA Lauren Darcey Shane Conder Sams Teach Yourself 24 in Hours Android ™ Application Development ptg Sams Teach Yourself Android Application Development in 24 Hours Copyright. Cataloging -in- Publication Data Darcey, Lauren, 1977- Sams teach yourself Android application development in 24 hours / Lauren Darcey, Shane Conder. p. cm. — (Sams teach yourself in 24 Hours) Includes. Diving Deeper into Android 347 22 Testing Android Applications . 367 ptg iv Teach Yourself Android Application Development in 24 Hours Part V: Publishing Your Application HOUR 23 Getting Ready

Ngày đăng: 29/04/2014, 15:24

Từ khóa liên quan

Mục lục

  • COVER

  • Contents at a Glance

  • Table of Contents

    • Introduction

    • Part I: Android Fundamentals

      • HOUR 1: Getting Started with Android

        • Introducing Android

        • Familiarizing Yourself with Eclipse

        • Running and Debugging Applications

        • Summary

        • Q&A

        • Workshop

        • HOUR 2: Mastering the Android Development Tools

          • Using the Android Documentation

          • Debugging Applications with DDMS

          • Working with the Android Emulator

          • Using Other Android Tools

          • Summary

          • Q&A

          • Workshop

          • HOUR 3: Building Android Applications

            • Designing a Typical Android Application

            • Using the Application Context

            • Working with Activities

            • Working with Intents

Tài liệu cùng người dùng

Tài liệu liên quan