Unlocking android

418 316 0
Unlocking android

Đ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

Tài liệu học Android-Unlocking android

Frank Ableson Charlie Collins Robi Sen F OREWORD BY D ICK W ALL MANNING Unlocking Unlocking Android Licensed to Deborah Christiansen <pedbro@gmail.com> Download at Boykma.Com Licensed to Deborah Christiansen <pedbro@gmail.com> Download at Boykma.Com Unlocking Android A D EVELOPER ’ S G UIDE W. FRANK ABLESON CHARLIE COLLINS ROBI SEN MANNING Greenwich (74° w. long.) Licensed to Deborah Christiansen <pedbro@gmail.com> Download at Boykma.Com To Nikki —W.F.A. For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. Sound View Court 3B fax: (609) 877-8256 Greenwich, CT 06830 email: orders@manning.com ©2009 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15% recycled and processed without the use of elemental chlorine. Development Editor Tom Cirtin Manning Publications Co. Copyeditor: Linda Recktenwald Sound View Court 3B Typesetter: Gordan Salinovic Greenwich, CT 06830 Cover designer: Leslie Haimes ISBN 978-1-933988-67-2 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – MAL – 14 13 12 11 10 09 Licensed to Deborah Christiansen <pedbro@gmail.com> Download at Boykma.Com v brief contents P ART 1 W HAT IS A NDROID ? — T HE B IG P ICTURE 1 1 ■ Targeting Android 3 2 ■ Development environment 32 P ART 2 E XERCISING THE A NDROID SDK . 57 3 ■ User interfaces 59 4 ■ Intents and services 97 5 ■ Storing and retrieving data 126 6 ■ Networking and web services 167 7 ■ Telephony 195 8 ■ Notifications and alarms 211 9 ■ Graphics and animation 226 10 ■ Multimedia 251 11 ■ Location, location, location 266 P ART 3 A NDROID APPLICATIONS . 293 12 ■ Putting it all together–the Field Service Application 295 13 ■ Hacking Android 341 Licensed to Deborah Christiansen <pedbro@gmail.com> Download at Boykma.Com Licensed to Deborah Christiansen <pedbro@gmail.com> Download at Boykma.Com vii contents foreword xiii preface xv acknowledgments xvii about this book xx about the cover illustration xxiv P ART 1W HAT IS A NDROID ? — T HE B IG P ICTURE 1 1 Targeting Android 3 1.1 Introducing Android 4 The Android platform 4 ■ In the market for an Android? 6 Licensing Android 10 1.2 Stacking up Android 11 Probing Android’s foundation 12 1.3 Booting Android development 14 Android’s good Intent-ions 14 ■ Activating Android 18 AndroidManifest.xml 25 ■ Mapping applications to processes 26 1.4 An Android application 27 1.5 Summary 30 Licensed to Deborah Christiansen <pedbro@gmail.com> Download at Boykma.Com CONTENTS viii 2 Development environment 32 2.1 The Android SDK 33 The application programming interface 33 ■ Core Android packages 33 Optional packages 34 2.2 Fitting the pieces together 35 Java Perspective 36 ■ DDMS Perspective 38 ■ Command-Line tools 40 2.3 Building an Android application in Eclipse 42 Android Project Wizard 43 ■ Android sample application code 43 Building the application 48 2.4 The Android Emulator 50 Skins 50 ■ Network speed 51 ■ Emulator profiles 53 2.5 Debugging 55 2.6 Summary 56 P ART 2E XERCISING THE A NDROID SDK .57 3 User interfaces 59 3.1 Creating the Activity 60 Creating an Activity class 62 ■ Exploring Activity lifecycle 67 3.2 Working with views 70 Exploring common views 71 ■ Using a ListView 73 ■ Multitasking with Handler and Message 77 ■ Creating custom views 78 Understanding layout 80 ■ Handling focus 82 ■ Grasping events 83 3.3 Using resources 84 Supported resource types 85 ■ Referencing resources in Java 85 Defining views and layouts through XML resources 87 Externalizing values 89 ■ Providing animations 92 3.4 Understanding the AndroidManifest file 93 3.5 Summary 95 4 Intents and services 97 4.1 Working with Intent classes 98 Defining intents 99 ■ Intent resolution 102 ■ Matching a custom URI 105 ■ Using Android-provided activities 109 4.2 Listening in with broadcast receivers 110 Overloading the Intent concept 110 ■ Creating a receiver 112 Licensed to Deborah Christiansen <pedbro@gmail.com> Download at Boykma.Com CONTENTS ix 4.3 Building a Service 113 Dual-purpose nature of a Service 113 ■ Creating a background task Service 114 4.4 Performing Inter-Process Communication 117 Android Interface Definition Language 117 ■ Exposing a remote interface 120 ■ Binding to a Service 120 ■ Starting versus binding 122 ■ Service lifecycle 123 ■ Binder and Parcelable 124 4.5 Summary 125 5 Storing and retrieving data 126 5.1 Using preferences 127 Working with SharedPreferences 127 ■ Preference access permissions 130 5.2 Using the filesystem 134 Creating files 134 ■ Accessing files 135 ■ Files as raw resources 136 ■ XML file resources 137 ■ External storage via an SD card 139 5.3 Persisting data to a database 143 Building and accessing a database 143 ■ Using the sqlite3 tool 148 5.4 Working with ContentProvider classes 149 Understanding URI representations and manipulating records 151 Creating a ContentProvider 158 5.5 Summary 165 6 Networking and web services 167 6.1 An overview of networking 169 Networking basics 169 ■ Clients and servers 171 6.2 Checking the network status 172 6.3 Communicating with a server socket 173 6.4 Working with HTTP 176 Simple HTTP and java.net 177 ■ Robust HTTP with HttpClient 179 Creating an HTTP and HTTPS helper 181 6.5 Web services 186 POX—Putting it together with HTTP and XML 187 ■ REST 189 To SOAP or not to SOAP, that is the question 193 6.6 Summary 194 Licensed to Deborah Christiansen <pedbro@gmail.com> Download at Boykma.Com . Targeting Android 3 1.1 Introducing Android 4 The Android platform 4 ■ In the market for an Android? 6 Licensing Android 10 1.2 Stacking up Android 11 Probing Android s. Booting Android development 14 Android s good Intent-ions 14 ■ Activating Android 18 AndroidManifest.xml 25 ■ Mapping applications to processes 26 1.4 An Android

Ngày đăng: 21/09/2013, 19:14

Từ khóa liên quan

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

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

Tài liệu liên quan