首页 > > > Apress.Pro.Android.3.Apr.2011.pdf

Apress.Pro.Android.3.Apr.2011.pdf

Apress.Pro.Android.3.Apr.2011.p…

上传者: xuanguang 2013-11-03 评分1 评论0 下载42 收藏10 阅读量152 暂无简介 简介 举报

简介:本文档为《Apress.Pro.Android.3.Apr.2011pdf》,可适用于手机软件领域,主题内容包含iProAndroidSatyaKomatineniDaveMacLeanSayedYHashimiProAndroidCopyrightbySat符等。

i Pro Android 3 Satya Komatineni Dave MacLean Sayed Y. Hashimi Pro Android 3 Copyright 2011 by Satya Komatineni, Dave MacLean, and Sayed Y. Hashimi All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-3222-3 ISBN-13 (electronic): 978-1-4302-3223-0 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. NFC Forum and the NFC Forum logo are trademarks of the Near Field Communication Forum. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. President and Publisher: Paul Manning Lead Editor: Matthew Moodie Technical Reviewer: Dylan Phillips Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Corbin Collins Copy Editors: Heather Lang, Tracy Brown, Mary Behr Compositor: MacPS, LLC Indexer: BIM Indexing & Proofreading Services Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. For information on translations, please e-mail rights@apress.com, or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at www.apress.com. D ow nl oa d fro m W ow ! e Bo ok < ww w. wo we bo ok .c om > To my brother Hari, to whom life yielded few favors. —Satya Komatineni To my wife, Rosie, and my son, Mike, for their support; I couldn't have done this without you. And to Max, for spending so much time at my feet keeping me company. —Dave MacLean To my son, Sayed-Adieb. —Sayed Y. Hashimi iv Contents at a Glance Contents ....................................................................................................................................................... vi Foreword ................................................................................................................................................... xviii About the Authors ....................................................................................................................................... xix About the Technical Reviewer ..................................................................................................................... xx Acknowledgments ...................................................................................................................................... xxi Preface ....................................................................................................................................................... xxii Chapter 1: Introducing the Android Computing Platform .......................................................................... 1 Chapter 2: Setting Up Your Development Environment ........................................................................... 21 Chapter 3: Understanding Android Resources ......................................................................................... 63 Chapter 4: Understanding Content Providers .......................................................................................... 89 Chapter 5: Understanding Intents .......................................................................................................... 125 Chapter 6: Building User Interfaces and Using Controls ........................................................................ 145 Chapter 7: Working with Menus ............................................................................................................ 217 Chapter 8: Working with Dialogs ........................................................................................................... 243 Chapter 9: Working with Preferences and Saving State ........................................................................ 265 Chapter 10: Exploring Security and Permissions .................................................................................. 287 Chapter 11: Building and Consuming Services ...................................................................................... 307 Chapter 12: Exploring Packages ............................................................................................................ 377 Chapter 13: Exploring Handlers ............................................................................................................. 399 Chapter 14: Broadcast Receivers and Long-Running Services .............................................................. 425 Chapter 15: Exploring the Alarm Manager ............................................................................................ 465 Chapter 16: Exploring 2D Animation ...................................................................................................... 491 Chapter 17: Exploring Maps and Location-based Services ................................................................... 519 Chapter 18: Using the Telephony APIs ................................................................................................... 559 Chapter 19: Understanding the Media Frameworks .............................................................................. 575 Chapter 20: Programming 3D Graphics with OpenGL ............................................................................ 623 Chapter 21: Exploring Live Folders ........................................................................................................ 693 Chapter 22: Home Screen Widgets ........................................................................................................ 711 Chapter 23: Android Search ................................................................................................................... 745 Chapter 24: Exploring Text to Speech .................................................................................................... 825 Chapter 25: Touch Screens .................................................................................................................... 845 Chapter 26: Using Sensors ..................................................................................................................... 891 Chapter 27: Exploring the Contacts API ................................................................................................. 937 Chapter 28: Deploying Your Application: Android Market and Beyond ................................................. 993 Chapter 29: Fragments for Tablets and More ...................................................................................... 1015 Chapter 30: Exploring ActionBar ......................................................................................................... 1069 Chapter 31: Additional Topics in 3.0 .................................................................................................... 1097 Index ....................................................................................................................................................... 1141 v Contents Contents at a Glance .......................................................................................... iv Foreword ........................................................................................................ xviii About the Authors ............................................................................................. xix About the Technical Reviewer ........................................................................... xx Acknowledgments ............................................................................................ xxi Preface ............................................................................................................ xxii Chapter 1: Introducing the Android Computing Platform ................................ 1 A New Platform for a New Personal Computer ....................................................................................................... 1 Early History of Android .......................................................................................................................................... 3 Delving Into the Dalvik VM ...................................................................................................................................... 6 Understanding the Android Software Stack ............................................................................................................ 6 Developing an End-User Application with the Android SDK .................................................................................... 8 Android Emulator ............................................................................................................................................... 8 The Android UI ................................................................................................................................................... 9 The Android Foundational Components ........................................................................................................... 10 Advanced UI Concepts ..................................................................................................................................... 11 Android Service Components ........................................................................................................................... 13 Android Media and Telephony Components .................................................................................................... 13 Android Java Packages .................................................................................................................................... 14 Taking Advantage of Android Source Code ........................................................................................................... 18 The Sample Projects in this Book ......................................................................................................................... 19 Summary .............................................................................................................................................................. 20 Chapter 2: Setting Up Your Development Environment ................................. 21 Setting Up Your Environment ................................................................................................................................ 22 Downloading JDK 6 .......................................................................................................................................... 22 Downloading Eclipse 3.6 .................................................................................................................................. 23 Downloading the Android SDK ......................................................................................................................... 23 The Tools Window ............................................................................................................................................ 26 Installing Android Development Tools (ADT) .................................................................................................... 26 CONTENTS vi Learning the Fundamental Components ............................................................................................................... 29 View ................................................................................................................................................................. 29 Activity ............................................................................................................................................................. 29 Intent ................................................................................................................................................................ 29 Content Provider .............................................................................................................................................. 30 Service ............................................................................................................................................................. 30 AndroidManifest.xml ........................................................................................................................................ 30 Android Virtual Devices .................................................................................................................................... 30 Hello World! .......................................................................................................................................................... 31 Android Virtual Devices ......................................................................................................................................... 37 Exploring the Structure of an Android Application ................................................................................................ 39 Analyzing the Notepad Application ....................................................................................................................... 42 Loading and Running the Notepad Application ................................................................................................ 42 Dissecting the Application ............................................................................................................................... 44 Examining the Application Lifecycle ..................................................................................................................... 51 Debugging Your App ............................................................................................................................................. 54 Launching the Emulator ................................................................................................................................... 56 StrictMode ....................................................................................................................................................... 57 References ....................................................................................................................................................... 61 Summary .............................................................................................................................................................. 62 Chapter 3: Understanding Android Resources .............................................. 63 Understanding Resources ..................................................................................................................................... 63 String Resources .............................................................................................................................................. 64 Layout Resources ............................................................................................................................................ 66 Resource Reference Syntax ............................................................................................................................. 67 Defining Your Own Resource IDs for Later Use ................................................................................................ 69 Compiled and Uncompiled Android Resources ................................................................................................ 70 Enumerating Key Android Resources .................................................................................................................... 71 Working with Arbitrary XML Resource Files ......................................................................................................... 80 Working with Raw Resources ............................................................................................................................... 82 Working with Assets ............................................................................................................................................. 82 Reviewing the Resources Directory Structure ...................................................................................................... 83 Resources and Configuration Changes ................................................................................................................. 83 Reference URLs .................................................................................................................................................... 87 Summary .............................................................................................................................................................. 88 Chapter 4: Understanding Content Providers ................................................ 89 Exploring Android’s Built-in Providers .................................................................................................................. 90 Architecture of Content Providers ......................................................................................................................... 96 Implementing Content Providers ........................................................................................................................ 108 Exercising the Book Provider .............................................................................................................................. 120 Adding A Book ................................................................................................................................................ 120 Removing a Book ........................................................................................................................................... 120 Getting a Count of the Books ......................................................................................................................... 121 Displaying the List of Books ........................................................................................................................... 121 Resources .....................................................................

该用户的其他资料

  • 名称/格式
  • 评分
  • 下载次数
  • 资料大小
  • 上传时间

用户评论

0/200
    暂无评论
上传我的资料

相关资料

资料评价:

/ 1200
所需积分:0 立即下载
返回
顶部
举报
资料
关闭

温馨提示

感谢您对爱问共享资料的支持,精彩活动将尽快为您呈现,敬请期待!