android for programmers an app driven approach deitel, deitel, deitel morgano 2011 11 03 Lập trình android

513 86 0
android for programmers  an app driven approach deitel, deitel, deitel   morgano 2011 11 03 Lập trình 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

ANDROID™ FOR PROGRAMMERS AN APP-DRIVEN APPROACH DEITEL® DEVELOPER SERIES CuuDuongThanCong.com Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests For more information, please contact: U S Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the U S., please contact: International Sales international@pearsoned.com Visit us on the Web: informit.com/ph Library of Congress Cataloging-in-Publication Data On file © 2012 Pearson Education, Inc Portions of the cover are modifications based on work created and shared by Google (http://code.google.com/ policies.html) and used according to terms described in the Creative Commons 3.0 Attribution License (http:// creativecommons.org/licenses/by/3.0/) All rights reserved Printed in the United States of America This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise To obtain permission to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290 ISBN-13: 978-0-13282154-4 ISBN-10: 0-13-282154-0 Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana Second printing, January 2012 CuuDuongThanCong.com ANDROID™ FOR PROGRAMMERS AN APP-DRIVEN APPROACH DEITEL® DEVELOPER SERIES Paul Deitel Harvey Deitel Abbey Deitel Deitel & Associates, Inc Michael Morgano Imerj Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City CuuDuongThanCong.com Trademarks DEITEL, the double-thumbs-up bug and DIVE INTO are registered trademarks of Deitel and Associates, Inc Java is a registered trademark of Oracle and/or its affiliates Other names may be trademarks of their respective owners Microsoft, Internet Explorer and the Windows logo are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries Google is a trademark of Google, Inc Throughout this book, trademarks are used Rather than put a trademark symbol in every occurrence of a trademarked name, we state that we are using the names in an editorial fashion only and to the benefit of the trademark owner, with no intention of infringement of the trademark CuuDuongThanCong.com In memory of Daniel McCracken Computer science has lost one of its greatest educators Paul, Harvey, Abbey and Michael CuuDuongThanCong.com This page intentionally left blank CuuDuongThanCong.com Contents Preface Before You Begin xiv xxii Introduction to Android 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 Introduction Android Overview Android 2.2 (Froyo) Android 2.3 (Gingerbread) Android 3.0 (Honeycomb) Android Ice Cream Sandwich Downloading Apps from the Android Market Packages Android Software Development Kit (SDK) Object Technology: A Quick Refresher Test-Driving the Doodlz App in an Android Virtual Device (AVD) Deitel Resources Android Development Resources Wrap-Up 10 12 15 16 17 18 20 23 32 33 34 Android Market and App Business Issues 2.1 2.2 2.3 Introduction Building Great Android Apps Android Best Practices 2.3.1 Compatibility 2.3.2 Supporting Multiple Screens 2.3.3 Android User Interface Guidelines Registering at Android Market Setting Up a Google Checkout Merchant Account AndroidManifest.xml File Preparing Your Apps for Publication Uploading Your Apps to Android Market Other Android App Marketplaces Pricing Your App: Free or Fee Monetizing Apps with In-App Advertising Monetizing Apps: Using In-App Billing to Sell Virtual Goods in Your Apps 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 CuuDuongThanCong.com 35 36 36 38 38 40 40 44 44 45 46 51 54 54 56 57 viii Contents 2.13 2.14 2.15 2.16 2.17 2.18 2.19 Launching the Market App from Within Your App Managing Your Apps in Android Market Marketing Your App Other Popular App Platforms Android Developer Documentation Android Humor Wrap-Up Welcome App Dive-Into® 59 59 59 64 65 66 67 68 Eclipse and the ADT Plugin 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 Introduction Technologies Overview Eclipse IDE Creating a New Project Building the Welcome App’s GUI with the ADT’s Visual Layout Editor Examining the main.xml File Running the Welcome App Wrap-Up 69 69 70 71 74 87 89 89 Tip Calculator App 4.1 4.2 4.3 4.4 4.5 4.6 Introduction Test-Driving the Tip Calculator App Technologies Overview Building the App’s GUI 4.4.1 TableLayout Introduction 4.4.2 Creating the Project and Adding the TableLayout and Components 4.4.3 Reviewing the Layout So Far 4.4.4 Customizing the Components to Complete the Design 4.4.5 Final XML Markup for the Tip Calculator GUI 4.4.6 strings.xml Adding Functionality to the App Wrap-Up Favorite Twitter® Searches App 91 Building an Android App with Java 92 93 94 94 94 95 99 99 102 106 106 116 117 SharedPreferences, Buttons, Nested Layouts, Intents, AlertDialogs, Inflating XML Layouts and the Manifest File 5.1 5.2 5.3 5.4 CuuDuongThanCong.com Introduction Test-Driving the Favorite Twitter Searches App Technologies Overview Building the App’s GUI and Resource Files 5.4.1 main.xml TableLayout 5.4.2 Creating the Project 5.4.3 Creating the Resource Files 118 119 121 123 123 124 124 Contents 5.5 5.6 5.7 5.4.4 Adding the TableLayout and Components 5.4.5 Creating a TableRow That Displays a Search and an Edit Button Building the App AndroidManifest.xml Wrap-Up Flag Quiz Game App ix 126 130 131 142 143 146 Assets, AssetManager, Tweened Animations, Handler, Menus and Logging Error Messages 6.1 6.2 6.3 6.4 6.5 6.6 6.7 Introduction Test-Driving the Flag Quiz Game App Technologies Overview Building the App’s GUI and Resource Files 6.4.1 main.xml LinearLayout 6.4.2 Creating the Project 6.4.3 Creating and Editing the Resource Files 6.4.4 Adding the Components to the LinearLayout 6.4.5 Creating a Button That Can Be Dynamically Inflated 6.4.6 Creating the Flag Shake Animation Building the App AndroidManifest.xml Wrap-Up Cannon Game App 147 151 151 153 153 153 154 155 158 158 160 174 175 176 Listening for Touches and Gestures, Manual Frame-By-Frame Animation, Graphics, Sound, Threading, SurfaceView and SurfaceHolder 7.1 7.2 7.3 7.4 7.5 7.6 CuuDuongThanCong.com Introduction Test-Driving the Cannon Game App Technologies Overview Building the App’s GUI and Resource Files 7.4.1 Creating the Project 7.4.2 AndroidManifest.xml 7.4.3 strings.xml 7.4.4 main.xml 7.4.5 Adding the Sounds to the App Building the App 7.5.1 Line Class Maintains a Line’s Endpoints 7.5.2 CannonGame Subclass of Activity 7.5.3 CannonView Subclass of View Wrap-Up 177 178 179 181 181 181 182 182 183 183 183 183 186 203 468 Index documentation (cont.) application resources (developer.android.com/ drive sales 55 duration of an animation 207, 220 dynamically load a resource 163 guide/topics/resources/ index.html) 81 Class Index Data Backup Debugging Tasks Managing Projects from Eclipse with ADT Package Index Publishing Your Applications Security and Permissions Tools Overview User Interface Guidelines Using the Android Emulator doInBackground method of class AsyncTask 271, 272, 272, 277 Doodlz app xvi, 23 double tap 20 double-tap event 180, 186, 195 downloading source code xvii downsample an image 326 dp (density-independent pixels) 82, 82, 83 drag 20 drag event 253 DragEvent framework 14 draw circles 181 lines 181 text 181 draw method of class Overlay 316 Drawable display on a Button 328 class 152, 167 createFromStream method 152, 167 Drawable resource shape element 265 drawBitmap method of class Canvas 250 drawCircle method of class Canvas 198 drawing characterstics 181 color 181 font size 181 line thickness 181 drawLine method of class Canvas 198 drawPath method of class Canvas 250, 254 drawRect method of class Canvas 198 drawText method of class Canvas 198 Drawable CuuDuongThanCong.com Environment class getExternalFilesDir method 371 method of class Bitmap 245 event distribution 14 event handler adding extra information to a View 326 returning false 186 returning true 186 event handling 94 events Examples xxx Examples.zip xxx Exchange Calendar execSQL method of class SQLiteDatabase 289 execute method of class AsyncTask 271 explicit Intent 141, 263, 275 export laws 53 Export Wizard 49 exposure data external storage directory 371 extra information for use in event handlers 326 extras for an Intent 275 eraseColor E method of class Log 167 Eclipse xiv, xv, xxiii, 23, 69 download (www.eclipse.org/ downloads/) xxiii import project 93, 119, 151, 178, 206 Java perspective 23 Outline window 93, 94 e Override/Implement Methods option 113 Eclipse documentation (www.eclipse.org/ documentation) xvii Eclipse IDE 2, 6, 19, 69, 70 Properties tab 69 Eclipse IDE for Java Developers xxii, xxiii Eclipse Resource Center (www.deitel.com/Eclipse/) xviii, 32 edit method of class SharedPreferences 136 Editable interface 107 EditText class 94, 107 android:hint attribute 129 android:imeOptions attribute 129, 268 android:inputType attribute 268 android:singleLine attribute 329 Cursor visible property 102 Long clickable property 102 EditText component Cursor visible property 102 Text size property 100 Emacs setting up for Android xxix emacs xxix Email 13 emulator 19, 47 emulator functionality 47 emulator gestures and controls 20 emulator limitations 47 encapsulation 22 End User License Agreement (EULA) 46, 47 Enhanced Address Book app xvi Enhanced Slideshow app xvi F Facebook xviii, 60, 61 Deitel page (www.deitel.com/ deitelfan/) 33, 60, 61, 459 friend 61 factory settings Favorite Twitter Searches app xvi, 118 featured apps 16 fee-based app 16 File class 371 getAbsolutePath method 371 file processing 361, 370 file system access 17 FileInputSteam class 364 FileOutputSteam class 363 fill_parent value of the android:layout_height attribute 88 financial transaction 58 findFragmentById method of class FragmentManager 407 finish method 346 finish method of class Activity 276, 346 Flag Quiz Game app xvi Index flash support fling 20 fling touch event 180 Focusable property of a component 102, 102 Folders res/menu 268 res/raw 179, 183 folders assets 151 res/anim 159 res/drawable 265 font size 181 format method of class String 179 format specifier multiple in a String resource 179, 182 numbering 179 numbering in a String resource 179, 182 format Strings 179 forums Android Forums Android Market Help Forum Stack Overflow fragment 392, 394 Fragment class 393, 394, 394, 401, 407, 415, 422, 425, 446 getArguments method 443 isAdded method 430 onActivityCreated method 416, 429 onCreateView method 424, 428 setArguments method 426, 442 fragment element in a layout XML file 397 FragmentManager class 395, 401, 407 findFragmentById method 407 fragments compatibility package 394 FragmentTransaction class 395, 397, 407, 408 commit method 408 replace method 408 frame-by-frame animation xvi FrameLayout class 182, 299, 397 fraudulent order 45 free app 16, 54 free apps xv friend 61 friend in Facebook 61 Froyo (Android 2.2) CuuDuongThanCong.com fully qualify a custom View’s class name in an XML layout 179 future proof 37 G Gallery 13 Gallery app 320 game loop 192, 201 games 37 gaming console gen folder of an android project 110 geographic coordinates 317 geographic location 297 geometric path 229 GeoPoint class 297, 306, 317 gesture double tap drag fling long press pinch zoom touch GestureDetector.OnDoubleTapListener interface 180, 186 GestureDetector.OnGestureListener interface 180 GestureDetector.SimpleGestureListener class 180, 186 GestureDetector.Simple- class method 186 GestureListener onDoubleTap Gestures drag flick long press pinch tap getAbsolutePath File method of class 371 method 413 method of class MotionEvent 252 getActionMasked method of class MotionEvent 251 getAll method of class SharedPreferences 134 getArguments method of class Fragment 443 getAssets method of class ContextWrapper 163, 167 getBearing method of class Location 306 getBestProvider method of class LocationManager 304 getActionBar getActionIndex getColumnIndex Cursor 469 method of class 278 method of class Cursor 278 getController method of class MapController 301 getCursor method of class CursorAdapter 272 getData method of class Intent 345 getDefaultSensor method of class SensorManager 236 getDouble method of class Bundle 111 getExternalFilesDir method of class Environment 371 getExtras method of class Intent 276, 282 getFragmentManager method of class Activity 401 getHeight method of class Display 312 getHolder method of class SurfaceView 190 getInt method of class SharedPreferences 214 getIntent method of class Activity 276, 282 getLastKnownLocation method of class LocationManager 304 getLatitude method of class Location 306 getListView method of class ListActivity 270, 329 getLong method of class Bundle 276 getLongitude method of class Location 306 getMenuInflater method of class Activity 273 getPointerCount method of class MotionEvent 253 getPreferences method of class Activity 211 getProjection method of class MapView 317 getResources method of class ContextWrapper 163 getSharedPreferences method of class Context 134 getString method of class Activity 140 getString method of class Bundle 111 getString method of class Cursor 278 getColumnIndexOrThrow 470 Index method of class 436 getString method of class Resource 179 getString method of class Resources 218 getString method of class SharedPreferences 135 getStringArray method of class Resources 406 getSystemService method of class Activity 138 getSystemService method of class Context 136 getSystemService method of clsdd Activity 236 getTag method 340, 341 getTag method of class View 326, 340, 341 getView method of class ArrayAdapter 339 getWidth method of class Display 312 getWritableDatase method of class SQLiteOpenHelper 285 getX method of class MotionEvent 253 getY method of class MotionEvent 253 Global Address Lists look-up Google APIs Google Checkout 55 Google Maps xvi, 9, 292 API 294 API key 294 obtain API key 294 satellite map 292 street map 292 Google Maps API 297, 299, 318 Google Maps web services xvi, xvii GPS xiv mock data for testing purposes 299 GPS data 297, 303 GPS Exchange Format 295 GPS fix 297, 307 GPS satellite 295 GPS signal 295 acquired 295 GPS_EVENT_FIRST_FIX constant of class GpsStatus 307 GPSLogger app for recording GPS data 295 GpsStatus class GPS_EVENT_FIRST_FIX 307 getString JsonReader CuuDuongThanCong.com interface 297, 304, 307 gpx extension 295 GPX File sending to an AVD 295 GPX file 295 GPX tab in the DDMS perspective 296 graphics xvi, 18 graphics APIs xvi Gravity property of a component 101 gravity sensor 14, 228 green method of class Color 241 guesture 19 GUI components Button 122 EditText 94 ImageView 69, 83 naming convention 94, 123, 153 programmatically create 122 ScrollView 121 SeekBar 92, 94 TextView 69, 74, 80, 94 ViewGroup 121 GUI design 37 gyroscope sensor 14, 228 GpsStatus.Listener Home screen widget 14 HTML5 HTTP Live Streaming (HLS) 14 HTTP progressive streaming humor 66 I i-Newswire 63 icon 42, 46, 47 icon design firms Aha-Soft 48 Androidicons 48 glyFX 48 Iconiza 48 Icon Design Guidelines 40, 48 icon design services 48 Id property of a layout or component 79, 83 IDE (integrated development environment) xvi, xxiii, 19 image downsample 326 image choosing Activity 346 images xvi ImageView android:adjustViewBounds attribute 157 class 69, 83 ImageView H method 219 Src property 69, 85 implicit Intent 141 import an existing project into Eclipse 93, 119, 151, 178, 206 Import dialog 24, 93, 119, 151, 178, 206 in-app advertising 54, 56 In-app billing 57 in-app billing 55, 57 security best practices 58 in-app purchase 58 incur data cost 303 inflate XML layout dynamically 122 inflate a layout 136 inflate method of class LayoutInflater 136 inflate the GUI 190 inflating a GUI 111 information hiding 22 inheritance 22, 94 InputMethodManager class 132 setImageResource class 152 method 152 removeCallbacks method 354 handling user events xvi hard buttons on an android device 25 hardware accelerated graphics 208 hardware support 18 Hardware-accelerated 2D graphics 15 HashMap class 153 hashtag 61 hasNext method of class JsonReader 450 head tracking 15 Headset Profile (HSP) 15 height of a table row 94 hide the soft keyboard 137 Handler postDelayed hideSoftInputFromWindow method of class InputMethodManager 138 hiding an app’s title bar 299 hint in an EditText 267 holographic theme 228, 230 holographic UI 12, 14 hideSoftInputFromWindow method 138 Index class 152, 167, 175 method 152, 167 InputStreamReader class 434, 449 insert method of class ContentResolver 256 insert method of class SQLiteDatabase 286 instance 21 instance variable 22 integrated development environment (IDE) xvi, xxiii, 19 IntelliJ Idea xxix enabling Android support xxix intent xvi Intent class 122, 132, 141 ACTION_GET_CONTENT constant 346 ACTION_VIEW constant 141 broadcast 396 Bundle 275 createChooser method 346 explicit 141, 263, 275 extras 275 getData method 345 getExtras method 276, 282 implicit 141 MIME type 325 putExtra method 275 setType method 346 intent-filter element of the manifest file 143 IntentService class 455 interface 94 implementing methods in Java 114 tagging interface 363 Interfaces 208 InputStream setImageDrawable AdapterView.OnItemClicked Listener 270 AdapterView.OnItemClickLi stener 274 AdapterView.OnItemLongCli ckListener 395 AnimatorListener 207 AnimatorUpdateListener 207 CompoundButton.OnCheckedChangeListener 297, 302, 309 DialogInterface.OnClickListener 132, 173 DialogInterface.OnMultiChoiceClickListener Editable CuuDuongThanCong.com 107 173 Interfaces (cont.) item GestureDetector.OnDoubleTapListener attribute 269 GestureListener OnItemLongClickListener 395 Runnable 152, 356 SeekBar.OnSeekBarChangeLi stener 107, 241, 242 228, SensorEventListener 237 Serializable 363, 367 SurfaceHolder.Callback 180, 190, 200 413 TextWatcher 107 TabListener View.OnClickListener 132 internationalization 81 Internet calling 11 Internet enabled applications xvi Internet Public Relations InternetNewsBureau.com 63 PRX Builder 63 Internet public relations resources ClickPress 63 Deitel Internet Public Relations Resource Center 62 i-Newswire 63 InternetNewsBureau.com 63 Marketwire 63 Mobility PR 63 openPR 63 PR Leap 63 Press Release Writing 63 PRLog 63 PRWeb 63 PRX Builder 63 Internet public relations resourcesPRWeb 63 Internet telephony 12 interpolator for an animation 207 invalidate method of class View 249 isAdded method of class Fragment 430 isRouteDisplayed method of class MapActivity 308 attribute 269 android:orderInCategory GestureDetector.On- 180 GpsStatus.Listener 297, 304, 307 List 153 LocationListener 297, 305, 306 Map 153 OnCompletionListener 385 element android:icon 180, 186 471 android:title attribute 269 android:titleCondensed attribute 269 element for defining a MenuItem in a resource file 268 item element in a string-array element 154 item J Jarsigner xxix, 49 Java xv, Java code xxii Java for Programmers, 2/e xv Java Fundamentals: Parts I and II xv Java How to Program xv Java perspective in Eclipse 23 Java SE Software Development Kit xxii java.io class 363 java.io package 152 java.util package 152 java.util.concurrent package 208 java.util.concurrent.atomic package 228 JavaScript Object Notation (JSON) 434 JSON (JavaScript Object Notation) 392, 434 JsonReader 396 JsonReader class 391, 396, 434, 438, 447 beginArray method 435, 440 beginObject method 435, 438, 440 getString method 436 hasNext method 450 nextName method 435, 438 nextString method 450 skipValue method 436, 440, 449, 450 K kernel memory management boost key/value pairs persistent 132 key/value pairs associated with an app 122 keyboard types 268 472 Index method of interface Map 134 Keytool xxix, 49 Khronos EGL APIs 18 Khronos EGL library 14 Khronos OpenGL ES interfaces 18 Khronos OpenSL ES API 14 keySet L label 46 landscape mode 208 landscape orientation 395 large-screen device 12, 14 latitude 297, 306, 318 launcher icon 40 layer components 299 layout 17 Layout height property of a component 101 Layout margin top property of a component 83 layout resource 262 Layout weight property of a component 102 Layout width property of a component 97, 127 match_parent value 97, 127 layout XML file create 130, 158 LayoutInflater class 122, 132 inflate method 136 LayoutParams class 311 Layouts FrameLayout 182, 299 layouts LinearLayout 74 main.xml 74 TableLayout 94, 123 license for Android licensing policy 48 licensing service 48 lifecycle methods 179 lifecycle methods of an app 106 light sensor 228 line thickness 181 linear acceleration sensor 228 LinearInterpolator class 221 LinearLayout 74 LinearLayout class 266 Linux 19 List interface 153 list item touched 274 touched row ID 275 CuuDuongThanCong.com method of class 163 list view icon 40 ListActivity class 263, 266, 269, 332, 343, 344, 370 built-in ListView 270 custom GUI 266 custom layout 325, 329 getListView method 270, 329 ListView android:id 329 setListAdapter method 271 listen for location changes 304 listening for touches xvi ListFragment class 393, 394, 415 ListView class 262, 266, 269, 325, 332, 343 format of a list item 266 in a Fragment 394 item layout 328, 330 ListView performance 326 load a URL into a web browser 122 load method of class SoundPool 190 loadAnimation method of class AnimationUtils 152, 163 localization 43, 81 numbering format specifiers in String resources 179 localize an app 95 location 292 bearing 292 direction 292 location animation 220 location changes listen for 304 Location class 297, 305 bearingTo method 306 distanceTo method 305 getBearing method 306 getLatitude method 306 getLongitude method 306 location provider 303 status 306 location providers 297 location-based services 18 LocationListener interface 297, 305, 306 onLocationChanged method 306 LocationManager class 297, 304 getBestProvider method 304 list AssetManager getLastKnownLocation method 304 requestLocationUpdates method 304 method of class 202 Log class 152, 167 e method 167 LogCat tab in the Android DDMS perspective 152 logcat tool 152 logging exceptions 152, 167 Long clickable property of an EditText 102 long press 20 longitude 297, 306, 318 long-press touch event 180 lockCanvas SurfaceHolder M Mac OS X xxiii, 19 magnetic field sensor 228 main.xml 74 contents explained 87 makeText method of class Toast 256 Manage Applications shortcut 11 managing persistent data xvi manifest 298, 327 receiver element 396 service element 396 manifest editor 143 manifest element of the manifest file 142 manifest file 14, 38, 45, 46, 52, 142, 296 access a non-standard library 296 uses-library element 296, 299 uses-permission element 296, 299 manually add an attribute to the XML 100 manually perform an animation 180 map 292 geographic coordinates 317 move the center 306 orientation 292 pixel coordinates 317 zoom level 301 Map interface 153 keySet method 134 map tiles 294 MapActivity class 297, 300 isRouteDisplayed method 308 MapController class 301, 306 animateTo method 306 getController method 301 setZoom method 301 Index Maps API xvi MapView class 297, 300, 301, 311, 312 getProjection method 317 setBuiltInZoomControls method 312 method 312 method 312 setLayoutParams method 312 setSatellite method 312 Market app 59 Market filters 39 marketing 16 Marketwire 63 mashup match_parent value for the Layout width property of a component 97, 127 match_parent value of the setClickable setEnabled android:layout_width attribute 88 value of the Layout height property 127, 156 match_parent value of the Layout width property 127, 156 MD5 fingerprint 294 media files 179 media framework 14 Media Transfer Protocol (MTP) 13 Media/Picture Transfer Protocol (MTP/PTP) 14 MediaController class 364 MediaPlayer class 326, 353, 353, 354, 354, 356 match_parent MediaPlayer.OnCompletionList ener class 364 MediaStore.Images.Thumbnails class 342 menu xvi Context menu 41 Options menu 41 class 152, 170 Menu Design Guidelines 41 menu element 268 menu icon 40 menu name xxii menu resources 262, 268 MenuInflater class 263, 273, 278 merchant account 44 Messaging 41 method 21, 94 method call 22 micro blogging 60, 61 microdegrees 306 MIME type 256 video/* 376 Menu CuuDuongThanCong.com MIME type of an Intent 325 Misc section of the Properties window 100 MKMapView class 290 mobile advertising 54 mobile advertising network 56, 62 AdMob 56 AdWhirl 64 Pinch Media 56 mobile advertising networks AdMob 63 AdMob (www.admob.com/) 63 AdWhirl 64 Decktrade 64 Flurry 64 Google AdSense for Mobile 64 Medialets 64 Nexage 64 Smaato 64 mobile app design resources Android Developer Guide: Compatibility 38 Android Developer Guide: Designing for Performance 38 Android Developer Guide: Designing for Responsiveness 38 Android Developer Guide: Designing for Seamlessness 38 Android Developer Guide: Supporting Multiple Screens 38 Android Developer Guide: User Interface Guidelines 38 mobile payment provider 58 Boku 59 PayPal Mobile Libraries 58 Zong 59 mobile payment providers 58 mock GPS data for testing purposes 299 modal dialog 122 MODE_PRIVATE constant 134 MODE_WORLD_READABLE constant 134 MODE_WORLD_WRITABLE constant 134 monetizing apps 36, 56, 63 MotionEvent class 179, 185, 229, 251 getActionIndex method 252 getActionMasked method 251 getPointerCount method 253 getX method 253 getY method 253 473 MOTODEV Studio for Android xxix move the center of the map 306 moveTo method of class Path 252 moveToFirst method of class Cursor 278, 278 MP3 12 MP3 player Multicore processor architecture 14 multimedia xvi multimedia playlist 14 multiple format specifiers 179, 182 multiselect 14 multitasking 13 multitouch screen music audio stream 180, 190 music library 320 N naming convention GUI components 94, 123, 153 Native Asset Manager API 14 native audio 14 native graphics management 14 native input 14 NAVIGATION_MODE_TABS 413 near-field communication (NFC) 11 API 12 device 11, 12 tag 11, 12 nested structure of a layout 96 nested Views 121 network access 17 networking 18 New Android Project dialog 71 New Android XML File dialog 124, 154 newsgroups Android Developers newTab method 413 newWakeLock method of class PowerManager 305 nextName method of class JsonReader 435, 438 nextString method of class JsonReader 450 NO_REQUIREMENT constant of class Criteria 303 non-standard library access 296 notification 14 notifyDataSetChanged method 326, 336, 341 474 Index notifyDataSetChanged method of class ArrayAdapter 326, 336, 341 NotSerializableException class 363 number picker 14 numbering format specifiers 179, 182 O obfuscate 49 object 20, 94 object (or instance) 22 object graph 363 object-oriented analysis and design (OOAD) 22 object-oriented language 22 object-oriented programming 94 object-oriented programming (OOP) 23 object serialization xvi, 361, 363, 370 ObjectAnimator class 207 ObjectInputSteam class 364, 372 ObjectInputStream class readObject method 364, 372 writeObject method 373 Objective-C command xxii ObjectOutputSteam class 373 ObjectOutputStream class 363 writeObject method 363 obtaining a Google Maps API key 294 OEM original equipment manufacturer onActivityCreated method of class Fragement 416 onActivityCreated method of class Fragment 429 onActivityResult method 334, 336, 341, 345 onActivityResult method of class Activity 334, 336, 341, 345, 375 onAnimationCancel method of interface AnimationListener 216 onAnimationEnd method of interface AnimatorListener 216, 221 onAnimationStart method of interface AnimatorListener 221 CuuDuongThanCong.com onCheckedChanged method of interface AsyncTask OnCheckedChangeListener 310 OnCheckedChangeListener interface 297, 302, 309 onCheckedChanged method 310 OnClickListener interface 208 onCompletion method of interface OnCompletionListener 385 OnCompletionListener interface 385 onCreate method of class Activity 108, 184, 212, 270, 276, 333, 344, 352, 371, 401 onCreate method of class SQLiteOpenHelper 289 onCreateOptionsMenu method of class Activity 152, 239, 278, 334 onCreateView method of class Fragment 424, 428 onDestroy method of class Activity 179, 184, 185, 354 onDoubleTap method of class GestureDetector.SimpleOn- 186 method of class SQLiteOpenHelper 289 onDraw method of class View 250 onItemClick method of interface GestureListener onDowngrade AdapterView.OnItemClickListener method of class 272, 273, 277, 278 onProgressUpdate method 272, 277 onProgressUpdate method of class AsyncTask 272, 277 onRestoreInstanceState method of class Activity 402 onResume method of class Activity 212, 271, 354, 403 onSaveInstanceState method of class Activity 108, 113, 351, 355, 402 on-screen component xxii onSensorChanged method 237 onSensorChanged method of interface SensorEventListener 237 onSizeChanged method of class View 190, 215, 249 onStart method of class Activity 212, 354 onStop method of class Activity 272, 305, 354 onTouchEvent method of class Activity 179, 185 OnTouchEvent method of class View 229, 250 onTouchEvent method of class View 221 onUpgrade method of class SQLiteOpenHelper 289 OOAD (object-oriented analysis and design) 22 OOP (object-oriented programming) 23 Open Handset Alliance open method of class Camera 381 open source open source apps Open Source Project discussion groups OpenCORE OpenGL 18 OpenGL ES xvi OpenGL renderer 15 opening a database 285 openPR 63 operating system operating system requirements xxii operating systems services 17 Options menu 41 orientation landscape 395 portrait 395 onPostExecute 274 OnItemClickedListener interface 270 OnItemClickListener interface 274 onItemClick method 274 OnItemLongClickListener interface 395 method of interface LocationListener 306 on–off state 297 on–off state button 292 onOptionsItemSelected method of class Activity 152, 241, 279, 334 onPause method of class Activity 179, 184, 185, 354 onPictureTaken method of class Camera.PictureCallback 382 onPostExecute method 272, 273, 277, 278 onLocationChanged Index original equipment manufacturer (OEM) Outline window 95, 96, 126 Outline window in Eclipse 93, 94 out-of-memory error 326 OutputSteam class 363 OutputStream class 229, 256 Overlay class 302, 314, 316 draw method 316 Override/Implement Methods Packages (cont.) java.io 17, 152, 363 java.net 18 java.nio 18 java.util 17, 152 java.util.concurrent permissions (cont.) android.permission.WAKE_ 208 java.util.concurrent.atom ic 228 javax.microedition.khrono s.egl 18 javax.microedition.khrono option in Eclipse 113 overscroll 262 s.opengles 18 18 18 Padding bottom property of a component 101, 102 padding element of a shape 265 Padding left property of a component 101, 102 Padding property of a layout 97 Padding right property of a component 101, 102 Paint class 181, 315 filled shape with a border 248 filled shape without a border 248 line 248 setAntiAlias method 248 setStrokeCap method 245, 248 setStrokeWidth method 248 setStyle method 248 styles 248 parse method of class Uri 141 PARTIAL_WAKE_LOCK constant of class PowerManager 305 password password expiration 15 Path class 229 moveTo method 252 quadTo method 253 reset method 252 pause method 354 pause method of class MediaPlayer 354 payment 45 payment processor 55 PendingIntent class 395, 456 performance 38 permissions 296 javax.xml.parsers P org.xml.sax package 17 Package Explorer window 73, 78, 93, 119, 151, 178, 206 Packages android.animation 207 android.app 17, 106, 132, 228, 394, 395 android.appwidget 18, 395 android.content 18, 122, 132, 229, 395, 396 android.content.res 17, 152, 163 android.database 18, 263 android.database.sqlite 18, 263 android.graphics 18, 181, 229 android.graphics.drawable 18, 152, 327 18, 228 18, 297 android.media 18, 180, 326 android.net 17, 132 android.opengl 18 android.os 17, 106, 152, 297 android.provider 18, 325 android.speech 18 android.speech.tts 18 android.telephony 18 android.text 17, 107 android.util 18, 152, 189, 396 android.view 17, 132, 152, 179, 180 android.view.animation 152 android.hardware android.location android.view.inputmethod 132 17, 75, 107, 132, 229, 297, 299 299 android.widget android.permission.ACCESS com.google.android.maps android.permission.INTERN 18, 297 CuuDuongThanCong.com android.permission.ACCESS _FINE_LOCATION _MOCK_LOCATION ET 299 475 299 LOCK 299 requesting 299 persistent key/value pairs 132 photo xvi photo preview 379 photo sharing 60 Photo Transfer Protocol (PTP) 13 photos picture take programmatically 364 pinch 20 Pinch Media 56 piracy 49 pixel coordinates 317 Pizza Ordering app xvi play method of class SoundPool 195 portrait mode 174, 190 portrait orientation 9, 395 postDelayed method of class Handler 152 power 303 power level 305, 305 power management 11 power state 297 POWER_HIGH constant of class Criteria 303 POWER_LOW constant of class Criteria 303 POWER_MEDIUM constant of class Criteria 303 PowerManager class 297, 305 newWakeLock method 305 PARTIAL_WAKE_LOCK 305 PR Leap 63 predefined color 127 predefined color transparent 130 prepare method 353 prepare method of class MediaPlayer 353 prepareAsync method 354 prepareAsync method of class MediaPlayer 354 Preparing to Publish: A Checklist 46 press release writing 63 pressure sensor 228 prevent the soft keyboard from displaying when app loads 123 price 16, 54, 55 privacy private key 49 PRLog 63 processing XML documents 18 476 Index programmatically create GUI components 122 progress bar 42, 43 Progress property of a SeekBar 101, 102 ProGuard 49 project 71 project, add a class 183 Projection class 317 toPixels method 317 Properties tab in Eclipse 69 Properties window 79, 80, 81 Misc section 100 property animation 159, 207 property-animation lifecycle events 207 proximity sensor 228 public relations 62 publish a new version of an app 59 publishing data on an Android device 18 put method of class ContentValues 256 putExtra method of class Intent 275 putString method of class SharedPreferences.Editor 136 Q quadratic bezier curve 253 quadTo method of class Path 253 query method of class SQLiteDatabase 288 Queue 208 Queue class 208 Quick Contact R class 110 R.color class 127 R.drawable class 110 R.id class 110, 111 R.layout class 110 R.layout.main constant 110, 133 R.string class 110 readObject method of class ObjectInputStream 364, 372 receiver element of the manifest 396 Recent Apps 13 reconfigure the camera 380 record GPS data 295 red method of class Color 241 redraw a View 250 R CuuDuongThanCong.com Reference Chooser dialog 85 resource files 73 registerListener method of class 398 124, 154 dimen.xml 124, 154 item element for defining a MenuItem 268 resource value access 129 access a color resource@color/ 129 access a dimension resource@dimen/ 130 access a string resource@string/ 129 resources SensorManager 236 RelativeLayout.LayoutParams class 219 method 354 release method of class MediaPlayer 354 release method of class SoundPool 200 release method of class WakeLock 305 release resources 278 Remote Wipe RemoteViews class 438, 453, 456, 458 remove apps from Market 59 remove method of class ArrayAdapter 348 removeAllViews method of class ViewGroup 137, 216 removeCallbacks method of class Handler 354 rendering and tracking text 17 Renderscript 3D graphics engine 14 replace method of class FragmentTransaction 408 reporting bugs requery method of class Cursor 273 request code 334 requesting app permissions 299 requestLocationUpdates method of class LocationManager 304 requirements 22 res folder of an Android project 74, 81 res/anim folder 159 res/drawable folder 265 res/menu folder 268 res/raw folder of an Android project 179, 183 res/values folder 124 reset method 356 reset method of class MediaPlayer 356 reset method of class Path 252 resource 52 Resource Chooser dialog 81 Resource class 179 getString method 179 resource file color element 125 create 124, 154 dimen element 125 resources element 125 release arrays.xml colors.xml android-developers blogspot.com 33 answers.oreilly.com/ topic/862-ten-tips-forandroid-applicationdevelopment/ 33 code.google.com/p/appsfor-android/ 33 developer.htc.com/ 33 developer.motorola.com/ 33 developer.sprint.com/ site/global/develop/ mobile_platforms/ android/android.jsp 33 developer.t-mobile.com/ site/global/resources/ partner_hubs/android/ p_android.jsp 33 dynamically load 163 layout 262 menu 262, 268 style 262, 264 www.androidtapp.com/10user-experience-tipsfor-successful-androidapps/ 33 www.brighthub.com/mobile/ google-android.aspx www.droidnova.com/ 33 33 www.ibm.com/ developerworks/ opensource/library/xandroid/index.html 33 www.youtube.com/user/ 33 class 163, 214 getString method 218 getStringArray method 406 resources element of a resource file 125 responsiveness 38 androiddevelopers Resources Index RESULT_CANCELED constant in class 336 RESULT_OK constant in class Activity 336 returning false from an event handler 186 returning true from an event handler 186 reusable software components 20 reuse 21 revenue share 16 reverse engineering 49 RGB color scheme 28 RGB values 79 right align text 101 right value of the Gravity property of a component 101 rotate a Canvas 314 rotate animation for a View 159 rotation animation 220 rotation vector sensor 228 Route Tracker app xvi, 19, 20 row ID of a touched list item 275 Runnable interface 152, 199, 356 runOnUiThread method of class Activity 199, 372, 373 Activity seamlessness 38 security SeekBar class 92, 94, 107 android:thumb attribute 231 Progress property 101, 102 SeekBar.OnSeekBarChangeListe interface 107, 241, 242 method 354 seekTo method of class MediaPlayer 354 select multiple components 99 select videos 361 selectTab method of class ActionBar 403 sell your app xv send a message to an object 22 sendBroadcast method of class Activity 405 sending GPS data to an AVD 295 Sensor class 228 sensor events 14 SENSOR_DELAY_NORMAL constant of class SensorManager 236, 237 SENSOR_SERVICE constant in class Context 237 ner seekTo Sensor.TYPE_ACCELEROMETER constant 236, 237 class 239 SensorEvent S satellite map 292, 295, 302 save data on the iPhone 118 saved state 110 SAX API (Simple API for XML) 18 scale animation 220 scale animation for a View 159 scale-independent pixel 125 scaled pixels (sp) 82 scale-independent pixels 82, 83 scaleX method of class ViewPropertyAnimator 220 scaleY method of class ViewPropertyAnimator 220 screen capture 50 screen density 40 screen dimensions 312 screen orientation 42 portrait 181 screen size 40 screenshot specifications 50 scroll scroll touch event 180 scrollable list of items 263 scrolling GUI components 119 ScrollView class 121, 266 SD card 43, 371 CuuDuongThanCong.com SensorEventListener interface 228, 237 SensorEventListener listener 237 SensorManager class 228, 235, 236 getDefaultSensor method 236 registerListener method 236 SensorManager.SENSOR_DELAY_ NORMAL constant 236, 237 sensors accelerometer 228, 237 gravity 228 gyroscope 228 light 228 linear acceleration 228 magnetic field 228 pressure 228 proximity 228 rotation vector 228 temperature 228 Serializable interface 363, 367 serialization 363 serialized object 363 service element of the manifest 396 477 service to inflate a layout 136 Session Initiation Protocol (SIP) 11 SIP providers 11 set in an animation 159 Set interface toArray method 134 setAccuracy method of class Criteria 303 setAltitudeRequired method of class Criteria 303 setAntiAlias method of class Paint 248 setArguments method of class Fragment 426, 442 setBackgroundColor method 242 setBackgroundColor method of class View 242 setBuiltInZoomControls method of class MapView 312 setClickable method of class MapView 312 setColorEffect method of class Camera.Parameters 380, 382 setCompoundDrawables method of class TextView 417 setContentView method of class Activity 110, 270 setContentView method of class Dialog 241, 244 setCostAllowed method of class Criteria 303 setDataSource method 353 setDataSource method of class MediaPlayer 353 setDuration method of class ViewPropertyAnimator 220 setEnabled method of class MapView 312 setGravity method of class Toast 256 setImageBitmap method of class View 245 setImageDrawable method of class InputStream 152, 167 setImageResource method of class ImageView 219 setItems method of class AlertDialog,Builder 173 setLayoutParams method of class MapView 312 setLayoutParams method of class View 219 setListAdapter method of class ListActivity 271 setListener method of class ViewPropertyAnimator 220 478 Index method 354 method of class MediaPlayer 354 setMultiChoiceItems method of class AlertDialog,Builder 173 setParameters method of class Camera 380, 382 setPowerRequirement method of class Criteria 303 setPreviewDisplay method of class Camera 382 setPreviewSize method of class Camera.Parameters 382 setRepeatCount method of class Animation 152, 163 setResult method of class Activity 382 setSatellite method of class MapView 312 setStrokeCap method of class Paint 245, 248 setStrokeWidth method of class Paint 248 setStyle method of class Paint 248 setTag method 339, 341 setTag method of class View 326, 339, 341 setLooping setLooping Setting hardware emulation options xxvii, 32 setType method of class Intent 346 setVolumeControlStream method of class Activity 180 setZoom method of class MapController 301 shape element 265 shared storage 324 SharedPreferences class 122, 132, 133, 403, 404, 405 apply method 405 default file 212 edit method 136 getAll method 134 getInt method 214 getString method 135 SharedPreferences.Editor class 122, 136 apply method 136 clear method 140 putString method 136 Shop4Apps 54 show method of class Dialog 241 shuffle a collection 167 CuuDuongThanCong.com method of class 152 shut down activity 185 signing apps 46 Simple API for XML (SAX API) 18 simple collision detection 194 simple touch events 179 SimpleCursorAdapter class 271, 325 shuffle Collections SimpleOmGestureListener interface 186 method of class JsonReader 436, 440, 449, 450 slider 94 Slideshow app xvi social bookmarking 60 social commerce 60 social media 59 social media sites Bebo 60 Blogger 60 Delicious 60 Digg 60 Facebook 60 Flickr 60 Foursquare 60 Gowalla 60 Groupon 60 LinkedIn 60 Squidoo 60 StumbleUpon 60 Tip’d 60 Twitter 60 Wordpress 60 YouTube (www.youtube.com) 60 social networking 60 social news 60 soft buttons on an Android device 25 soft keyboard prevent from displaying when app loads 123 types 268 sort (case insensitive) 134 sort method of class Arrays 134, 135 sound effects 180 sound files 183 sound quality 190 Sound Recorder app 322 SoundPool class 180, 190 load method 190 play method 195 release method 200 sounds 179 skipValue source code source-code listing sp (scaled pixels) 82 spanning multiple columns in a TableLayout 99 specify a component’s column number in a TableLayout 100 Speech APIs xvi speech recognition xvi, 18, 43 speech synthesis xvi, 43 speech-to-text input 43 speed 297 splash screen 43 Spot-On Game app xvi SQLite 18, 263 SQLite xvi SQLite Resource Center (www.deitel.com/SQLite3/) xviii, 32 SQLiteDatabase class 263 delete method 288 execSQL method 289 insert method 286 query method 288 update method 287 SQLiteOpenHelper class 263, 285, 288 getWritableDatabase method 285 method 289 onDowngrade method 289 onUpgrade method 289 onCreate SQLiteOpenHelpter>default class method 285 Src property of an ImageView 69, 85 stack components 299 Stagefright standard icons 269, 327 star ratings for apps 59 start method 354 start method of class MediaPlayer 354 startActivity method of class Activity 325 startActivity method of class Context 122, 141 startActivityForResult method of class Activity 325, 334, 340, 345 startAnimation method of class View 152 startManagingCursor method of class Activity 273 para font> close Index startPreview Camera method of class 382 startTransition method of class 358 status bar icon 40 stopPreview method of class Camera 382 Storage Manager API 14 stream for playing music 190 streaming 17 streaming media 354 street map 292, 295, 302 Stretch columns property of a TableLayout 97, 127 String arrays defining in strings.xml 154 String class format method 179 String resource containing multiple format specifiers 179, 182 String resources 230 String.CASE_INSENSITIVE_ORDE R Comparator object 134 element element 154 string-array element in strings.xml 154 strings.xml 81, 95, 126, 182 defining String arrays 154 numbering format specifiers for localization 179 string-array element 154 stroke element of a shape 265 style attribute of a GUI component 262, 266 style element 264 style resources 262, 264 item element 264 name attribute 264 subclass 94 supporting multiple screens 38 supports-screens element 40 surfaceChanged method of interface SurfaceHolder.Callback 200 surfaceCreated method of class SurfaceHolder.Callback 381, 382 surfaceCreated method of interface SurfaceHolder.Callback 200 surfaceDestroyed method of class SurfaceHolder.Callback 381 item CuuDuongThanCong.com method of 200 SurfaceHolder class 180, 190, 378, 379 addCallback method 190 lockCanvas method 202 SurfaceHolder.Callback class 379, 380 surfaceCreated method 381, 382 surfaceDestroyed method 381 SurfaceHolder.Callback TransitionDrawable string-array surfaceDestroyed SurfaceHolder.Callback interface 180, 190, 200 surfaceChanged method 200 surfaceCreated method 200 surfaceDestroyed method 200 SurfaceView class 180, 190, 364, 366, 378, 379 getHolder method 190 swipe 6, 20 synchronized 202 syntax shading xvii, System Bar 12, 13 T class 413 tab icon 40 tabbed navigation 392 selected tab 402 TableLayout class 94, 123, 266 Tab android:stretchColumns attribute 97, 123, 129 columns numbered from 100 documentation (developer.android.com/ reference/android/ widget/ TableLayout.html) 94 spanning multiple columns 99 specify a component’s column number 100 TableRow class 94 documentation (developer.android.com/ reference/android/ widget/TableRow.html) 94 tablet 12 interface 413 tagging interface 363 take a picture 361, 364 tap 20 target SDK version 208, 230, 396 tasks 41 telephony xiv, xvi TabListener 479 temperature sensor 228 testing 47 tethering text alignment right 101 text box 94 Text color property of a component 83 text field 94 Text property of a component 69, 81 Text size property of a component 83 Text size property of an EditText 100 Text style property of a component 83 text-to-speech 18, 43 Text-to-Speech (TTS) 43 TextView class 69, 80, 94, 107 setCompoundDrawables method 417 property 69 TextView component 74 TextWatcher interface 107 thread UI 372 thread (for animation) 180 Thread class 201 Threadr class 180 thread-safe list 208 thumbnail utility TimeInterpolator class 220 time-lapse video recording 13 Tip Calculator app xv, 20, 92 title bar hiding 299 toArray method of interface Set 134 Toast class 229, 256, 295, 372 makeText method 256 setGravity method 256 ToggleButton class 292, 297 android:textOff attribute 299 Tools logcat 152 toPixels method of class Projection 317 touch event 229, 250 touch events 379 double tap 180, 186 fling 180 long press 180 scroll 180 simple 179 Text 480 Index touched list item 274 track app installs 59 transaction fee 45 transfering music and photos to an AVD 323 transferring data via Bluetooth xvi TRANSIT_FRAGMENT_FADE 408 TransitionDrawable class 327, 358 startTransition method 358 translate animation android:duration attribute 159 android:fromXDelta attribute 159 android:startOffset attribute 159 android:toXDelta attribute 159 animation for a View 159 translation animation 220 transparency 80, 228 transparent predefined Android color 130 transparent predefined color 130 TTS (Text-to-Speech)) 43 turn off logging and debugging 46 tweened animation 159 tweening 207 tweet 61 Twitter xviii, 61 @deitel 33, 61, 459 #AndroidFP 61 hashtag 61 search 118 search operators 118 tweet 61 TYPE_ACCELEROMETER constant of class Sensor 236, 237 translate U UI thread 372 unique row ID of a touched list item 275 update method of class SQLiteDatabase 287 upgrading a database 285 Uri class 132, 141 parse method 141 USB Debugging 47 USB debugging 31 User Interface Guidelines 36 uses-library element of manifest 296, 299 CuuDuongThanCong.com element of manifest 296, 299 uses-sdk element of the manifest file 142 using an external library 299 utilities 37 uses-permission V ValueAnimator class 207 values folder of an Android project 81 version code 48 version name 48 versioning your app 46 Versioning Your Applications 48 vertically center text 101 video xiv, xvi, 6, 18 video driver 14 video format 12 video playback video sharing 60 VideoView class 361, 363, 364, 384 view xvi, 107 View animation 207 View animations 159 View class 180, 242, 339, 340, 341 animate method 207, 220 custom subclass 186 dispatchDraw method 313 getTag method 326 invalidate method 249 onDraw method 250 onSizeChanged method 190, 215, 249 OnTouchEvent method 229, 250 onTouchEvent method 221 redraw a View 250 setImageBitmap method 245 setLayoutParams method 219 setTag method 326 size changes 190 startAnimation method 152 View hierarchy 215 View.OnClickListener interface 132 ViewGroup class 121 removeAllViews method 137, 216 View-Holder Pattern 336 view-holder pattern 326 ViewPropertyAnimator class 207, 220 scaleX method 220 scaleY method 220 ViewPropertyAnimator class (cont.) setDuration setListener method 220 method 220 method 220 method 220 viral marketing 59, 60 viral video 61 virtual camera operator 15 virtual goods 57 Visual Layout Editor 69, 74, 93, 94 select multiple components 99 Voice Recorder app xvi volume 180 VP8 open video compression 12 x y W class 297, 305 method 305 release method 305 Weather AppWidget 40 Weather Viewer app xvi WeatherBug web services xvii web services xvi, xvii, 9, 434 Amazon eCommerce 10 eBay 10 Facebook 10 Flickr 10 Foursquare 10 Google Maps 10 Groupon 10 Last.fm 10 LinkedIn 10 Microsoft Bing 10 Netflix 10 PayPal 10 Salesforce.com 10 Skype 10 Twitter 10 WeatherBug 10 Wikipedia 10 Yahoo Search 10 YouTube 10 Zillow 10 web services directories APIfinder 10 Google Code API Directory 10 ProgrammableWeb 10 Webapi.org 10 Webmashup.com 10 WebM open container format 12 Welcome app xv, 19 Welcome tab 23 Welcome tab in Eclipse 70 WakeLock acquire Index widget xiv, xvi, 17, 107, 132 Android Agenda Widget 41 ESPN ScoreCenter 40 Widget Design Guidelines 40 WIDGET_UPDATE_BROADCAST_ ACTION 405 widgets 40 App Protector Pro 41 BatteryLife 41 Difficult Logic Riddles Pro 41 ecoTips 41 ESPN ScoreCenter 40 Favorite Quotes 41 Pandora Radio 40 Shazam Encore 41 Stock Alert 41 System Info Widget 41 The Coupons App 41 Twidroyd PRO 41 Weather & Toggle Widget 41 WeatherBug Elite 41 CuuDuongThanCong.com width of a column 94 Wi-Fi 8, 13 hotspot Windows 19 word-of-mouth marketing 60 wrap_content value of the android:layout_height attribute 88 wrap_content value of the android:layout_width attribute 88 X x method of class ViewPropertyAnimator 220 XML layout inflate dynamically 122 XML markup of a GUI 94 XML utilities 18 Y y method of class ViewPropertyAnimator WRITE_EXTERNAL_STORAGE permission 365 writeObject method of class ObjectInputStream 373 writeObject method of class ObjectOutputStream 363 www.deitel.com 32 www.deitel.com/training 459 www.housingmaps.com 481 Z zipalign 49 zoom 6, zoom level of a map 301 220 CuuDuongThanCong.com ... www.engadget.com/2010/05/13/android- 2-2 -froyo-toinclude-usb-tethering-wifi-hotspot-funct/ Fig 1.6 | Android 2.2 user features (developer.android.com/sdk/ android-2.2-highlights.html) CuuDuongThanCong.com... code.google.com/p/apps-for-android/ developer.android.com/resources/ browser.html?tag=sample www.techdrivein.com/2010/11/12-open-sourceandroid-applications.html simple-open-source-android.html Fig 1.3 | Open-source... Saddle River, New Jersey 07458, or you may fax your request to (201) 23 6-3 290 ISBN-13: 97 8-0 -1 328215 4-4 ISBN-10: 0-1 3-2 8215 4-0 Text printed in the United States on recycled paper at RR Donnelley

Ngày đăng: 29/08/2020, 15:15

Mục lục

  • 1.6 Android Ice Cream Sandwich

  • 1.7 Downloading Apps from the Android Market

  • 1.9 Android Software Development Kit (SDK)

  • 1.10 Object Technology: A Quick Refresher

  • 1.11 Test-Driving the Doodlz App in an Android Virtual Device (AVD)

  • 2.2 Building Great Android Apps

  • 2.3.3 Android User Interface Guidelines

  • 2.4 Registering at Android Market

  • 2.5 Setting Up a Google Checkout Merchant Account

  • 2.7 Preparing Your Apps for Publication

  • 2.8 Uploading Your Apps to Android Market

  • 2.9 Other Android App Marketplaces

  • 2.10 Pricing Your App: Free or Fee

  • 2.11 Monetizing Apps with In-App Advertising

  • 2.12 Monetizing Apps: Using In-App Billing to Sell Virtual Goods in Your Apps

  • 2.13 Launching the Market App from Within Your App

  • 2.14 Managing Your Apps in Android Market

  • 2.16 Other Popular App Platforms

  • 3.4 Creating a New Project

  • 3.5 Building the Welcome App’s GUI with the ADT’s Visual Layout Editor

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

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

Tài liệu liên quan