Android application development in 24 hours (2010, darcey l )

475 733 1
Android application development in 24 hours (2010, darcey l )

Đ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 From the Library of Wow! eBook 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 From the Library of Wow! eBook 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 From the Library of Wow! eBook 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 From the Library of Wow! eBook 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 From the Library of Wow! eBook 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 From the Library of Wow! eBook 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 From the Library of Wow! eBook 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 From the Library of Wow! eBook [...]... Automated builds and application deployment to Android emulators and handsets Application packaging and code signing tools for release 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,... Let’s begin by writing a simple Android “Hello, World” application that displays a line of text to the user As you do so, you will also be taking a tour through the Eclipse environment Specifically, you will learn about the features offered by the Android Development Tools (ADT) plug -in for Eclipse The ADT plug -in provides functionality for developing, compiling, packaging, and deploying Android applications... virtually no 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. .. Yourself Edit a String Resource If you inspect the main.xml layout file of the project, you will notice that it displays a simple layout with a single TextView control This user interface control simply displays a string In this case, the string displayed is defined in the string resource called @string/hello To edit the string resource called @string/hello, using the string resource editor, follow these steps:... the strings.xml file in the resource editor 2 Select the String called hello and note the name (hello) and value (Hello World, DroidActivity !) shown in the resource editor 3 Within the Value field, change the text to Hello, Dave 4 Save the file If you switch to the strings.xml tab and look through the raw XML, you will notice that two string elements are defined within a block: . 409 Installing the Java Development Kit 410 Installing the Eclipse IDE . 410 Installing the Android SDK 411 Installing and Configuring the Android Plug -in for Eclipse (ADT) . 412 Upgrading the Android. 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. 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

Ngày đăng: 24/04/2014, 11:02

Từ khóa liên quan

Mục lục

  • 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

      • Working with Dialogs

      • Logging Application Information

      • Summary

      • Q&A

      • Workshop

    • HOUR 4: Managing Application Resources

      • Using Application and System Resources

      • Working with Simple Resource Values

      • Working with Drawable Resources

      • Working with Layouts

      • Working with Files

      • Working with Other Types of Resources

      • Summary

      • Q&A

      • Workshop

    • HOUR 5: Configuring the Android Manifest File

      • Exploring the Android Manifest File

      • Configuring Basic Application Settings

      • Defining Activities

      • Managing Application Permissions

      • Managing Other Application Settings

      • Summary

      • Q&A

      • Workshop

    • HOUR 6: Designing an Application Framework

      • Designing an Android Trivia Game

      • Implementing an Application Prototype

      • Running the Game Prototype

      • Summary

      • Q&A

      • Workshop

  • Part II: Building an Application Framework

    • HOUR 7: Implementing an Animated Splash Screen

      • Designing the Splash Screen

      • Implementing the Splash Screen Layout

      • Working with Animation

      • Summary

      • Q&A

      • Workshop

    • HOUR 8: Implementing the Main Menu Screen

      • Designing the Main Menu Screen

      • Implementing the Main Menu Screen Layout

      • Working with the ListView Control

      • Working with Other Menu Types

      • Summary

      • Q&A

      • Workshop

    • HOUR 9: Developing the Help and Scores Screens

      • Designing the Help Screen

      • Implementing the Help Screen Layout

      • Working with Files

      • Designing the Scores Screen

      • Implementing the Scores Screen Layout

      • Designing a Screen with Tabs

      • Working with XML

      • Summary

      • Q&A

      • Workshop

    • HOUR 10: Building Forms to Collect User Input

      • Designing the Settings Screen

      • Implementing the Settings Screen Layout

      • Using Common Form Controls

      • Saving Form Data with SharedPreferences

      • Summary

      • Q&A

      • Workshop

    • HOUR 11: Using Dialogs to Collect User Input

      • Working with Activity Dialogs

      • Using DatePickerDialog

      • Working with Custom Dialogs

      • Summary

      • Q&A

      • Workshop

    • HOUR 12: Adding Application Logic

      • Designing the Game Screen

      • Implementing the Game Screen Layout

      • Working with ViewSwitcher Controls

      • Wiring Up Game Logic

      • Summary

      • Q&A

      • Workshop

  • Part III: Enhancing Your Application with Powerful Android Features

    • HOUR 13: Working with Images and the Camera

      • Designing the Avatar Feature

      • Adding an Avatar to the Settings Screen Layout

      • Working with ImageButton Controls

      • Working with Image Media

      • Working with Bitmaps

      • Summary

      • Q&A

      • Workshop

    • HOUR 14: Adding Support for Location-Based Services

      • Designing the Favorite Place Feature

      • Implementing the Framework for the Favorite Place Feature

      • Using Location-Based Services

      • Using Geocoding Services

      • Working with Maps

      • Summary

      • Q&A

      • Workshop

    • HOUR 15: Adding Network Support

      • Designing Network Applications

      • Developing Network Applications

      • Accessing Network Services

      • Indicating Network Activity with Progress Bars

      • Running Tasks Asynchronously

      • Downloading and Displaying Scores

      • Downloading and Parsing Question Batches

      • Summary

      • Q&A

      • Workshop

    • HOUR 16: Adding More Network Support

      • Determining Data to Send to the Server

      • Accessing Phone Status Information

      • Uploading Data to a Remote Application Server

      • Summary

      • Q&A

      • Workshop

    • HOUR 17: Adding Social Features

      • Enhancing Your Application with Social Features

      • Adding Friend Support to Your Application

      • Integrating with Social Networking Services

      • Summary

      • Q&A

      • Workshop

    • HOUR 18: Creating a Home Screen App Widget

      • Designing an App Widget

      • Handling App Widget User Events

      • Working with Widget Background Operations

      • Summary

      • Q&A

      • Workshop

  • Part IV: Adding Polish to Your Android Application

    • HOUR 19: Internationalizing Your Application

      • General Internationalization Principles

      • How Android Localization Works

      • Android Internationalization Strategies

      • Using Localization Utilities

      • Summary

      • Q&A

      • Workshop

    • HOUR 20: Developing for Different Devices

      • Configuration Management for Android

      • Summary

      • Q&A

      • Workshop

    • HOUR 21: Diving Deeper into Android

      • Exploring More Core Android Features

      • Designing Advanced User Interfaces

      • Working with Multimedia

      • Working with 2D and 3D Graphics

      • Personalizing Android Devices

      • Managing and Sharing Data

      • Accessing Underlying Device Hardware

      • Summary

      • Q&A

      • Workshop

    • HOUR 22: Testing Android Applications

      • Testing Best Practices

      • Maximizing Test Coverage

      • Summary

      • Q&A

      • Workshop

  • Part V: Publishing Your Application

    • HOUR 23: Getting Ready to Publish

      • Understanding the Release Process

      • Preparing the Release Candidate Build

      • Testing the Application Release Candidate

      • Packaging and Signing an Application

      • Testing the Signed Application Package

      • Summary

      • Q&A

      • Workshop

    • HOUR 24: Publishing on the Android Market

      • Selling on the Android Market

      • Exploring Other Android Publishing Options

      • Summary

      • Q&A

      • Workshop

  • Part VI: Appendixes

    • APPENDIX A: Configuring Your Android Development Environment

      • Development Machine Prerequisites

      • Installing the Java Development Kit

      • Installing the Eclipse IDE

      • Installing the Android SDK

      • Installing and Configuring the Android Plug-in for Eclipse (ADT)

      • Upgrading the Android SDK

      • Configuring Development Hardware for Device Debugging

    • APPENDIX B: Eclipse IDE Tips and Tricks

      • Creating New Classes and Methods

      • Organizing Imports

      • Documenting Code

      • Using Auto-Complete

      • Editing Code Efficiently

      • Renaming Almost Anything

      • Formatting Code

      • Organizing Code

      • Fun with Refactoring

      • Resolving Mysterious Build Errors

      • Creating Custom Log Filters

      • Moving Tabs Around

      • Integrating Source Control

    • APPENDIX C: Supplementary Materials

      • Accessing the Publisher’s Website

      • Accessing the Authors’ Website

      • Contacting the Authors

      • Leveraging Online Android Resources

  • Index

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J-K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    • W

    • X-Y-Z

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

  • Đang cập nhật ...

Tài liệu liên quan