Index

Symbols

3D objects, drawing, 325

coloring vertices, 326

complex objects, 327-328

lighting scenes, 329-330

texturing objects, 331-332

vertices, 325-326

A

accessibility features, 150-151

accessing

images on devices, 66-67

Internet, 170

handling network operations asynchronously, 174-179

HttpURLConnection, 171-172

parsing XML from the network, 172-174

reading data from the web, 170-171

retrieving Android network status, 179-180

secondary logs, LogCat, 455

accessories, USB, 268

Accessory Development Kit (ADK), 149-150

Account Manager, 405-406

synchronizing data with sync adapters, 406-407

accounts

creating Google accounts for analytics, 429-430

managing with Account Manager, 405-406

acquiring references to sensors, 256

acting as content type handlers, 381-382

action bars, 105-106

advanced features, 114

application icon clicks, 112-113

contextual action mode, 114

creating basic action bars, 106-109

customizing, 110-111

screens that do not require action bars, 114

action tag, 384

ActionScript 3, 196

Activity class, 108

implementing to process intents, 383

activity tag, 384

ad and market referrals, tracking, 438

ADB (Android Debug Bridge), 447

backup services, 455-456

bug reports, 456

copying files, 450

directing commands to specific devices, 448

installing applications, 451

installing custom binaries via the shell, 459-461

listing connected devices and emulators, 447

LogCat, 452

accessing secondary logs, 455

displaying log information, 452

filtering log information, 453-454

including date and time with log data, 452

redirecting log output to files, 454

monkey tool, 456-459

reinstalling applications, 451

retrieving files from devices or emulators, 450

sending files to devices or emulators, 450

shell commands, issuing, 449-450

starting ADB server process, 448

stopping ADB server process, 448

uninstalling applications, 452

using shell to inspect SQLite databases, 456

using shell to stress test applications, 456-458

ADB commands, listing, 448

ADB server process, 448

ADB shell, sqlite3, 464

addGlobalFocusChangeListener() method, 129

addGlobalLayoutListener() method, 129

addHelper() method, 409

adding

browser chrome with WebChromeClient, 188-189

features to WebView, 186

libraries to Eclipse projects, 431

addJavascriptInterface() method, 194

addOnTouchModeChangeListener() method, 27

ADK (Accessory Development Kit), 149-150

advanced action bar features, action bars, 114

AIDL files, 25

AIR apps, building for Android, 196

altering data in tables, SQLite, 473

alternative resources

internationalization, 416-417

changing language settings, 418-420

leveraging, 161

alternatives to C2DM, 403

Amazon Appstore in-app billing APIs, leveraging, 426

Amazon Kindle Fire, developing applications for, 166

analytics, creating Google accounts for, 429-430

Android, extending web application functionality to, 190-195

Android Application server side, integrating C2DM services, 402-403

Android applications, developing for Google TV, 165-166

Android Backup Service, registering with, 408

Android Beam, 269

configuring manifest files, 272

enabling sending, 270-271

receiving messages, 271-272

Android client side, integrating C2DM services, 402

Android Debug Bridge. See ADB

Android Design, 99-100

Android Lint Tool, 151

Android manifest file, configuring for sensors, 255

Android manifest files, configuring

for App Widgets, 373-374

for live wallpaper, 379

for searches, 394-395

Android Market campaign tracking, 438

Android Market in-app billing APIs, leveraging, 425-426

Android NDK (Native Development Kit), 355

creating projects, 357-358

calling native code from Java, 358-359

exceptions with native code, 360-362

native activities, 362

parameters and return values, 359-360

exploring, 357

improving graphics performance, 362-363

installing, 356

running sample applications, 357

versus RenderScript, 363

when to use, 355-356

Android network status, retrieving, 179-180

Android SDK, OpenGL ES APIs, 317

Android Software Development Kit (SDK), 17

android.speech.RecognizerIntent, 152

animation, 301

frame-by-frame animation, 302-303

interpolators, 313-314

property animation, 309

as XML resources, 310-311

defining programmatically, 311

starting programmatically, 312

tweened animation, 304-305

loading, 306

moving transformations, 308

programmatically, 305

rotating transformations, 307

scaling transformations, 308

transparency transformations, 307

as XML resources, 304

ANR (Application Not Responding) events, 9

anti-aliasing, Paint, 281

anti-piracy tips, 445-446

API Level 11, execute() method, 12

APIs

debug API key, 207-208

OpenGL ES, 317

App Widgets, 366-367

becoming hosts, 375

configuring Android manifest files, 373-374

creating, 367

configurations, 367-368

determining whether configuration activities are required, 369

providers, 369

remote views, 370-371

update services, 372-373

updating, 372

installing, 374-375

application broadcasts, securing, 80

application context, SQLite database instances

creating, 36

deleting, 47

application database files, finding on device file systems, 36

application icon clicks, action bars, 112-113

application lifecycle, cursors, 42

application manifest files, registering backup agents, 412

Application Not Responding events, 9

application threads

OpenGL threads talking to application threads, 333-334

talking to OpenGL threads, 335-337

applications

ADB

installing, 451

reinstalling, 451

uninstalling, 452

collecting data from, Google Analytics SDK, 432

configuring for OpenGL ES 2.0, 341

developing for Amazon Kindle Fire, 166

developing for Google TV, 164-165

developing for tables, 162-163

enabling searches, 386-387

enhancing, 365-366

internationalizing, 415

alternative resources, 416-417

changing language settings, 418-420

implementing locale support programmatically, 421

publishing for foreign users, 422

AppWidgetProvider class, 369

implementing, 369-370

archived data, wiping (ADB), 456

arcs, drawing, 294-295

asynchronous processing, importance of, 9-10

AsyncTask class, 10-12, 174-175

attracting users, device diversity, 161

audio, 233

playing, 235

recording, 233-234

sharing, 236

AudioManager, 235

AUTOINCREMENT, creating tables, 470

B

backup agents

implementing, 409

backup helpers for files, 410-412

backup helpers for shared preferences, 409

providing backup agent implementation, 409

registering in application manifest files, 412

backup helpers for files, implementing, 410-412

backup helpers for shared preferences, implementing, 409

backup operations, forcing ADB, 455

backup services, 407

ADB, 455

forcing backup operations, 455

forcing restore operations, 456

wiping archived data, 456

backup and restoring application data, 412

requesting backups, 412

requesting restores, 413

implementing backup agents, 409

backup helpers for files, 410-412

backup helpers for shared preferences, 409

providing backup agent implementation, 409

registering backup agents in application manifest files, 412

remote backup services, 408

registering with Android Backup Service, 408

BackupManager, 412

backups, requesting, 412

basic broadcasts, sending, 74

basic searches, enabling, 387

batteries, monitoring, 258-260

BatteryManager object, 260

BATTERY_STATS permission, 259

binding data

to application user interfaces, 50-51

with data adapters, 51

with simpleCursorAdapter, 51-54

bitmaps, 287

drawing on Canvas, 287

scaling graphics, 287

transforming with matrixes, 287-288

blinking lights, notifications, 92-93

blocking operations, 9

Bluetooth, 263-264

checking for existence of, 264

discovering devices, 265

enabling, 264

establishing connections, 266

querying for paired devices, 265

BluetoothAdapter class, 264

BluetoothDevice class, 264

BluetoothServerSocket class, 264

BluetoothSocket class, 264

BroadcastReceiver object, 31

broadcasts

ordered broadcasts, 73

receiving, 75

handling incoming broadcasts, 77-79

registering to receive, 76

registering to receive dynamically, 76-77

registering to receive statically, 77

securing application broadcasts, 80

sending, 73-74

Browser application, 183

browser chrome, adding with WebChromeClient, 188-189

browsing

web with WebView, 183-184

WebKit APIs, 190

bug reports, ADB, 456

C

C2DM (Cloud to Device Messaging), 399

alternatives to, 403

integrating

on Android Application server side, 402-403

on Android client side, 402

limitations of, 400-401

message flow, 400

overview, 399

sample applications, 403

signing up for, 401

calculated columns, SQLite, 474-476

subqueries, 476

calibrating sensors, 258

call state, requesting, 240-242

callbacks, 22

CallVoidMethod(), 361

Camera class, 225

cameras, 220

assigning images as wallpaper, 227-228

capturing still images, 220-225

choosing from device cameras, 228-229

face detection, 233

mode settings, 225

parameters, 225

sharing images, 226-227

video, 229

playing, 231

recording, 229-230

zooming, 226

CameraSurfaceView, 221-224

cancelDiscovery() method, 265

Canvas, 279-281

drawing bitmaps, 287

linear gradients, 282

radical gradients, 283

sweep gradients, 283

capture() method, 224

capturing still images with cameras, 220-225

choosing from device cameras, 228-229

Chrome to Phone app, 403

circles, drawing, 293-294

classes

Activity, 108

AppWidgetProvider, 369

implementing, 369-370

AsyncTask, 10-12, 174-175

BluetoothAdapter, 264

BluetoothDevice, 264

BluetoothServerSocket, 264

BluetoothSocket, 264

Camera, 225

CameraSurfaceView, 221, 224

ContextMenu, 103

Cursor, 41

CursorAdapter, 69

GameAreaView, 133-136

GeomagneticField, 258

GestureDetector, 132-133

GestureListener, 140

GLSurfaceView.Renderer class, 317

GpsSatellite, 216

IntentService, 29-30, 32

ItemizedOverlay, 215

JavaScriptExtensions, 192

Loader, 14

Matrix, 287

Parcelable, 26-29

PrefListenerService, 372

RSSurfaceView, 350

ScrubActivity, 112

SensorManager, 255

Shape, 289

ShapeDrawable, 289

SimpleDataUpdateService, 372

SQLiteDatabase

deleting records, 39

inserting records, 38

updating records, 39

SQLiteOpenHelper, 48-49

Thread, 13-14, 175-176

UriMatcher, 60-61

UsbManager, 268

ViewTreeObserver, 128

WebChromeClient, 192

cleaning up OpenGL ES, 337

clearing

logs (LogCat), 454

notifications, 90

clicks, listening for long clicks, 129-130

clipboard, 126

copying data to system clipboard, 127

pasting data to system clipboard, 127

close() method, 47

closing SQLite databases, 47

Cloud to Device Messaging. See C2DM

collecting data from applications, Google Analytics SDK, 432

color, Paint, 281

coloring vertices, 326

commands, ADB commands

directing to specific devices, 448

listing, 448

compatibility

notifications, 84

OpenGL, 316-317

complex objects, drawing, 327-328

composite primary keys, SQLite, 472

configurations, App Widgets, 367-368

configuring

Android manifest file for sensors, 255

Android manifest files

for App Widgets, 373-374

for live wallpaper, 379

for searches, 394-395

applications for OpenGL ES 2.0, 341

ProGuard for your apps, 443-444

SQLite database properties, 37

connected devices and emulators, listing in ADB, 447

connecting to SQLite databases, sqlite3, 464

connections, establishing between devices (Bluetooth), 266

content

loading into WebView, 184-186

locating with URIs, 67

content providers, 57

accessing images on devices, 66-67

data columns, 59

data URIs, 59

data-binding to gallery control, 69-70

enhancing applications, 65

implementing interfaces, 58

implementing methods, 59

delete() method, 63-64

getType() method, 64-65

insert() method, 61-62

query() method, 59-60

update() method, 62-63

locating content using URIs, 67

retrieving data with CursorLoader, 68-69

retrieving gallery images and saving to databases, 71

updating manifest files, 65

UriMatcher class, 60-61

content type handlers, acting as, 381-382

context menus, 103-105

Context.getSystemService() method, 269

Context.startService() method, 18

ContextMenu class, 103

contextual action mode, 114

controlling

hardware acceleration, 298

services, 23-24

copying

data to system clipboard, 127

files, ADB, 450

createBitmap() method, 287

createScript() method, 350

Cursor class, 41

Cursor objects, 42

CursorAdapter class, extending, 69

CursorLoader, retrieving content provider data, 68-69

cursors, SQLite databases, 41-42

custom binaries, installing via shell (ADB), 459-461

custom view control, rendering to, 350-352

customizing

action bars, 110-111

notifications, 94-96

D

Dalvik Debug Monitor Service (DDMS), 241

data, 50

binding

to application user interfaces, 50-51

with data adapters, 51

with SimpleCursorAdapter, 51-54

collecting from applications, Google Analytics SDK, 432

copying to system clipboard, 127

extracting in SQLite databases, 42-43

pasting to system clipboard, 127

reading from the web, 170-171

sensor data, reading, 256-257

synchronizing with sync adapters, 406-407

data adapters, binding data, 51

data binding to gallery control, 69-70

data columns, defining, 59

data connection speed, monitoring, 243

data URIs, defining, 59

databases

persistent databases, designing, 47-48

SQLite, importing/exporting, 466-468

dataChanged() method, 412

DDMS (Dalvik Debug Monitor Service), 241

debug API key, 207-208

default fonts, 284-285

delete() method, content providers, 63-64

deleteDatabase() method, 47

deleting

records, SQLiteDatabase class, 39

SQLite database instances with application context, 47

SQLite databases, tables and objects, 47

tables, SQLite, 476

designing

flexible user interfaces, 160

layouts with WebView, 184

notifications, 96

persistent databases, 47

field names, 48

SQLiteOpenHelper class, 48-49

student grade database example, 470

destroyRenderScriptGL() method, 351

detecting user motions within a view, 131-132

developing

Android applications for Google TV, 165-166

applications

for Amazon Kindle Fire, developing apps for, 166

for Google TV, 164-165

for tablets, 162-163

device, determining location of, 198-200

device cameras, choosing from, 228-229

device compatibility, OpenGL, 316-317

device diversity, 159-160

alternative resources, 161

attracting new types of users, 161

designing flexible user interfaces, 160

screen space, 161-162

device file system, finding application database files, 36

device orientation, determining, 258

device sensors, 254-255

acquiring references to, 256

calibrating, 258

configuring Android manifest file for sensors, 255

determining orientation, 258

finding true north, 258

reading sensor data, 256-257

devices

ADB, 450

discovering, 265

dictionaries, user dictionaries, 126

directing ADB commands to specific devices, 448

discovering devices, Bluetooth, 265

dispatch() method, 432

displaying

images from network resources, 177-179

log information, LogCat, 452

divideMessages() method, 248

doAlert() function, 193

doBackup() method, 412

doConsoleLog() function, 193

doInBackground() method, 11

doRestore() methods, 412

doServiceStart() method, 21

doSetFormText() function, 193

doToast() function, 193

double-tap gesture, 133

drag and drop framework, gestures, 143

Drawable, 215

drawing

3D objects, 325

coloring vertices, 326

complex objects, 327-328

lighting scenes, 329-330

texturing objects, 331-332

vertices, 325-326

shapes, 291

arcs, 294-295

ovals and circles, 293-294

paths, 295-297

rectangles and squares, 291

rectangles with rounded corners, 291-293

drawing on the screen, 279

Canvas, 279-281

linear gradients, 282

OpenGL ES, 323-324

Paint, 279-281, 284

radical gradients, 283

sweep gradients, 283

E

easy OpenGL ES, GLSurfaceView, 337-340

Eclipse, AIDL files, 25

Eclipse projects, adding libraries to, 431

eCommece, Google Analytics SDK, 436

logging events, 436-437

reviewing reports, 437

EGL, initializing, 321-323

EGLConfig object, 340

eglDestroyContext(), 337

eglDestroySurface(), 337

eglMakeCurrent(), 337

emulators

ADB, 450

locating, 200

enhancing applications, 365-366

error reports, ProGuard, 444

events

eCommerce events, logging, 436-437

handling WebView events with WebViewClient, 186-187

logging Google Analytics SDK, 432

user events. See user events

ExceptionOccurred(), 361

exceptions with native code, Android NDK, 360-362

execSQL() method, 37

execute() method, AsyncTask class, 11

executing

commands on command line, SQLite, 468

queries, 44

raw queries, 46

SQLiteQueryBuilder, 45

exporting databases, SQLite, 466-468

extending web application functionality to Android, 190-195

extracting data, SQLite databases, 42-43

F

face detection, 233

features, adding to WebView, 186

field names, databases, 48

files

copying in ADB, 450

retrieving from devices or emulators, 450

sending to devices or emulators, 450

filtering log information, LogCat, 453-454

finding application database files on device file system, 36

finding true north, sensors, 258

fine-tuning hardware acceleration, 298

Flash, 195

building AIR apps for Android, 196

enabling applications, 195

fling gesture, 133

focus changes, listening for, 130-131

fonts, default fonts, 284-285

foreign keys, SQLite, 472

foreign users, publishing applications for, 422

formatNumber() method, 243

frame-by-frame animation, 302-303

G

Galaxy Nexus Android device, 255

gallery control, data binding to, 69-70

game design, 162

GameAreaView class, 133-136

Geocoder object, 201-203

geocoding locations, 200-204

GeomagneticField class, 258

GestureDetector class, 132-133

GestureListener class, 140

GestureOverlayView, 132

gestures, 131

detecting user motions within a view, 131-132

drag and drop framework, 143

making them natural, 142

multi-touch gestures, 139-141

single-touch gestures, 132-138

getAccessoryList() method, 268

getAddressLine() method, 202

getAvailableLocales() method, 421

getBestProvider() method, 199

getCenter() method, 216

getDefault() method, 421

getDuration(), 232

getFeatureName() method, 202

getLocality() method, 202

getRoaming() method, 242

getSystemService() method, 240

getTextBounds method, 287

getType() method, content providers, 64-65

GL (Graphics Library), 315

initializing, 323

glCompileShader(), 344

GLDebugHelper, 323

glDrawArrays(), 325

glDrawElements(), 325

global positioning services. See GPS

global search

enabling, 395

updating search configurations, 396

updating search settings, 397

glShaderSource() method, 344

GLSurfaceView, 317

GLSurfaceView (easy OpenGL ES), 337-340

GLSurfaceView.Render class, 317

glUseProgram() method, 344

Google Analytics, creating Google accounts for, 429-430

Google Analytics Dashboard, 433-435

Google Analytics SDK

adding the library to your Eclipse project, 431

collecting data from applications, 432

eCommerce, 436

logging events, 436-437

reviewing reports, 437

gathering statistics, 438-439

logging different events, 432

protecting users’ privacy, 439

tracking ad and market referrals, 438

Google APIs, 201

Google TV

developing Android applications for, 165-166

developing applications for, 164-165

optimizing web applications for, 165

GPS (global positioning services), 197-198

determining location of device, 198-200

locating your emulator, 200

GpsSatellite class, 216

GPXPoint class, 27

gradients, Paint, 281

graphics

bitmap graphics, scaling, 287

improving performance (Android NDK), 362-363

guidelines, user interfaces, 99

H

hardware

Android Beam, 269

configuring manifest files, 272

enabling sending, 270-271

receiving messages, 271-272

batteries, 258-260

Bluetooth, 263-264

checking for existence of, 264

discovering devices, 265

enabling, 264

establishing connections, 266

querying for paired devices, 265

device sensors, 254-255

acquiring reference to, 256

calibrating, 258

configuring Android manifest file, 255

determining device orientation, 258

finding true north, 258

reading sensor data, 256-257

interacting with, 253-254

USB, 267

accessories, 268

hosts, 269

Wi-Fi, 273

monitoring, 274-276

Wi-Fi Direct, 273

hardware acceleration, 297

controlling, 298

fine-tuning, 298

hosts

App Widgets, 375

USB, 269

HTTP, 170

HttpURLConnection, 171-172

reading data from the web, 170-171

HttpURLConnection, 171-172

I

icons, text notifications, 85-86

images

accessing on devices, 66-67

assigning as wallpaper, 227-228

displaying from network resources, 177-179

retrieving, 71

saving to databases, 71

sharing, 226-227

IME (Input Method Editors), 123

implementing

backup agents, 409

backup helpers for files, 410-412

backup helpers for shared preferences, 409

providing backup agent implementation, 409

registering backup agents in application manifest files, 412

content provider interfaces, 58

content provider methods, 59

delete() method, 63-64

getType() method, 64-65

insert() method, 61-62

query() method, 59-60

update() method, 62-63

importing databases, SQLite, 466-468

improving graphics performance, Android NDK, 362-363

in-app billing, 424-425, 445

defined, 423-424

leveraging

Amazon Appstore in-app billing APIs, 426

Android Market in-app billing APIs, 425-426

in-app billing APIs, 427

PayPal in-app billing APIs, 426

incoming broadcasts, handling, 77-79

init(), 347, 350

initializing

EGL, OpenGL ES, 321-323

GL, OpenGL ES, 323

Input Method Editors (IME), 123

insert() method, content providers, 61-62

inserting

data into tables, SQLite, 471

records, SQLiteDatabase class, 38

installing

Android NDK, 356

App Widgets, 374-375

applications, ADB, 451

custom binaries via shell, ADB, 459-461

live wallpaper, 379

instances

SQLite database instances, creating with application context, 36

SQLite databases, deleting with application context, 47

Integrated Raster Imaging System Graphics Library (IRIS GL), 315

integrating C2DM services

on Android application server side, 402-403

on Android client side, 402

intent actions, 382

Intent extras, 31

intent filter, registering, 384

IntentFilter, 32

intents

implementing Activity to process, 383

mapping, 205

IntentService class, 29-32

interacting with hardware, 253-254

interfaces

content provider interfaces, implementing, 58

designing flexible user interfaces, 160

internationalizing applications, 415

alternative resources, 416-420

implementing locale support programmatically, 421

Internet, accessing, 170

handling network operations asynchronously, 174-179

HttpURLConnection, 171-172

parsing XML from the network, 172-174

reading data from the web, 170-171

retrieving Android network status, 179-180

interpolators, 313-314

invalidate() method, 140

IRemoteInterface, 25-26

IRIS GL (Integrated Raster Imaging System Graphics Library), 315

isDiscovering() method, 265

issuing shell commands, 449-450

ItemizedOverlay class, 215

iterating rows of query results, SQLite databases, 42-43

J

Java, calling native code (Android NDK), 358-359

JavaScriptExtensions class, 192

JNIenvironment object, 360

JOIN, querying multiple tables (SQLite), 474

K

Khronos Group, 315

Kindle Fire, 161

L

languages, 416-417

changing settings, 418-420

layouts, designing with WebView, 184

LBS (location-based services), 197, 216

geocoding locations, 200-204

GPS (global positioning services), 197-198

determining location of device, 198-200

locating your emulator, 200

mapping locations, 204

debug API key, 207-208

intents, 205

marking the spot, 211-216

panning map view, 209

views, 206-207

zooming map view, 210

leveraging

Amazon Appstore in-app billing APIs, 426

Android Market in-app billing APIs, 425-426

billing APIs, 427

hardware acceleration, 297

License Verification Library, 444-445

OpenGL ES in Android, 316

PayPal in-app billing APIs, 426

style inheritance, 117-119

libraries adding to Eclipse projects, 431

License Verification Library (LVL), leveraging, 444-445

lighting scenes, 329-330

lights, blinking (notifications), 92-93

limitations

of C2DM, 400-401

of SQLite, 469

linear gradients, 282

listening

for events on the entire screen, 128-129

for focus changes, 130-131

for long clicks, 129-130

for touch mode changes, 127-128

listing

ADB commands, 448

connected devices and emulators, ADB, 447

ListView container, 51

live wallpaper, 375

configuring Android manifest files, 379

creating, 376

creating configurations, 378

creating service, 376-377

installing, 379

service engine, implementing, 377-378

live wallpaper service, implementing, 377

live wallpaper service engine, implementing, 377-378

loadAndCompileShader() method, 344

Loader class, 14

loading

animations, 306

content into WebView, 184-186

locale support, implementing programmatically, 421

locating content using URIs, 67

location-based services. See LBS

LocationListener, 199

LocationListener object, 22-23

LocationManager object, 199

locations

geocoding, 200-204

mapping, 204

debug API key, 207-208

intents, 205

marking the spot, 211-216

panning map view, 209

views, 206-207

zooming map view, 210

log information, filtering (ADB), 453-454

LogCat, 144

ADB, 452

accessing secondary logs, 455

displaying log information, 452

filtering log information, 453-454

including date and time with log data, 452

redirecting log output to files, 454

logging

eCommerce events, 436-437

events, Google Analytics SDK, 432

logs, clearing (LogCat), 454

long clicks, listening for, 129-130

LVL (License Verification Library), 444-445

M

managing

accounts with Account Manager, 405-406

WebView state, 189

manifest files

configuring for Android Beam, 272

updating, 65

map view

panning, 209

zooming, 210

MapActivity, 206

MapController object, 207

mapping locations, 204

debug API key, 207-208

intents, 205

marking the spot, 211-216

panning map view, 209

views, 206-207

zooming map view, 210

MapView object, 206

MapView XML, 206

marking the spot, mapping locations, 211-216

Matrix class, 287

matrixes, transforming bitmaps, 287-288

measureText() method, 287

menus, 100

context menus, 103-105

options menus, 100-103

popup menus, 105

message flow, C2DM, 400

MIME types, 381-382

mobile networking, 169

Mobile Payment Libraries, 426

mode settings, cameras, 225

modifying WebView settings with WebSettings, 186

monitoring

batteries, 258-260

signal strength and data connection speed, 243

Wi-Fi, 274-276

monkey tool, ADB, 456-459

moving transformations, animations, 308

multi-touch gestures, 139-141

multimedia, 219-220

audio, 233

playing, 235

recording, 233-234

sharing, 236

cameras, 220

assigning images as wallpaper, 227-228

capturing still images, 220-225

choosing from device cameras, 228-229

face detection, 233

mode settings, 225

parameters, 225

sharing images, 226-227

video. See video

zooming, 226

ringtones, 238

searching, 236-237

N

native activities, Android NDK, 362

native code, exceptions (Android NDK), 360-362

Native Development Kit. See Android NDK

Near Field Communications (NFC), 269

network operations, handling asynchronously, 174-176

displaying images from network resources, 177-179

network resources, displaying images from, 177-179

networking, strict mode, 170

NFC (Near Field Communications), 269

noises, notifications, 93

notification queue, 86-87

NotificationManager, 85

notifications, 83-84

blinking lights, 92-93

clearing, 90

compatibility, 84

customizing, 94-96

designing, 96

noises, 93

status bar, 84-85

NotificationManager service, 85

test notification with icons, 85-86

updating, 88-89

vibrating phones, 91-92

notify() method, 86

notifyChange() method, 64

notifying users, 83-84

O

obfuscating with ProGuard, 443

error reports, 444

objects

SQLite databases, deleting, 47

texturing, 331-332

onActivityResult() method, 154

onAnimateMove() method, 138

onBackup() method, 411

onClick() method, 233

onCreate() method, 215

onCreateContextMenu() method, 104

onCreateLoader() method, 14

onDestroy() method, 22

onDetachedFromWindow() method, 351

onDoubleTap, 132

onDoubleTapEvent, 132

onDown, 132

onDraw() method, 139, 211

onFling, 133

onInit() method, 156

onKeyDown() method, 336

onKeyUp() method, 336

onLoaderReset() method, 14

onLoadFinished() method, 14

onLocationChanged() method, 200

onLongPress, 132

onOptionsItemSelected() method, 102, 112

onPause() method, 189

onPostExecute() method, 11

onPreExecute() method, 11

onProgressUpdate() method, 11

onReceive() callback method, 32

onReceive() method, 369

onRestore() method, 411

onScale() helper method, 140

onScroll, 133

onSensorChanged() method, 257

onServiceConnected() method, 26

onServiceDisconnected() method, 26

onServiceStateChanged method, 241

onShowPress, 132

onSingleTapConfirmed, 132

onSingleTapUp, 132

onStart() method, 18

onStartCommand() method, 18

onSurfaceCreate(), 342

onSurfaceCreated() method, 340

onTouchEvent() method, 139

onTrackballEvent(), 143

onUpdate() method, 372

OpenGL, 315

device compatibility, 316-317

enabling application threads to talk to, 335-337

enabling OpenGL threads to talk to application threads, 333-334

OpenGL ES, 315

APIs in Android SDK, 317

cleaning up, 337

drawing 3D objects

coloring vertices, 326

complex objects, 327-328

lighting scenes, 329-330

texturing objects, 331-332

vertices, 325-326

handling tasks manually, 318

drawing on the screen, 323-324

initializing EGL, 321-323

initializing GL, 323

starting threads, 319-321

SurfaceView, 318-319

leveraging in Android, 316

OpenGL ES 1.x, 341

OpenGL ES 2.0, 341

configuring applications for, 341

requesting surfaces, 341-345

openOrCreateDatabase() method, 36

optimizing web applications for Google TV, 165

options menus, 100-103

ordered broadcasts, 73

sending, 74

OrientationEventListener, 145

ovals, drawing, 293-294

P

Paint, 279-281, 284

Paint gradients, 281

paired devices, querying for, 265

panning map view, 209

parameters

Android NDK, 359-360

cameras, 225

Parcelable class, 26-29

parsing XML from the network, 172-174

pasting data to system clipboard, 127

paths, drawing, 295-297

pauseTimers(), 189

PayPal in-app billing APIs, leveraging, 426

performance of graphics, improving (Android NDK), 362-363

permission

to access phone state information, 240

gaining to send and receive SMS messages, 244

persistent database, designing, 47

field names, 48

SQLiteOpenHelper class, 48-49

PetTracker, 47

PetTracker3, 67

phone calls

making, 248-250

receiving, 251

phone numbers, 243-244

phone state information, gaining permission to access, 240

phones, vibrating notifications, 91-92

piracy. See software piracy

playing

audio, 235

video, 231

popup menus, 105

PrefListenerService class, 372

privacy, Google Analytics, 439

programmatically defining

property animations, 311

shape drawables, 290

tweened animations, 305

programmatically implementing locale support, 421

ProGuard, 442-443

configuring for your apps, 443-444

error reports, 444

projects, Android NDK, 357-358

calling native code from Java, 358-359

exceptions with native code, 360-362

native activities, 362

parameters and return values, 359-360

property animation, 309

defining programmatically, 311

starting programmatically, 312

as XML resources, 310-311

providing backup agent implementation, 409

publishing applications for foreign users, 422

publishProgress() method, 11

Q

queries, executing, 44

raw queries, 46

SQLiteQueryBuilder, 45

query results, iterating rows of (SQLite databases), 42-43

query() method, 44

content providers, 59-60

querying

multiple tables with JOIN, SQLite, 474

for paired devices, Bluetooth, 265

SQLite databases, 41

cursors, 41-42

iterating rows of query results and extracting data, 42-43

tables with SELECT (SQLite), 471

R

radical gradients, 283

raw queries, executing, 46

rawQuery() method, 46

reconfiguring manifest files for Android Beam, 272

reading

data from the web, 170-171

sensor data, 256-257

receiving

Android Beam messages, 271-272

broadcasts, 75

handling incoming broadcasts, 77-79

registering to receive, 76

registering to receive dynamically, 76-77

registering to receive statically, 77

phone calls, 251

SMS, 247-248

RecognizerIntent, 153-154

recording

audio, 233-234

video, 229-230

records

deleting in SQLiteDatabase class, 39

inserting in SQLiteDatabase class, 38

updating in SQLiteDatabase class, 39

rectangles, drawing, 291

with rounded corners, 291-293

redirecting log output to files, LogCat, 454

references to sensors, acquiring, 256

registerForContextMenu(), 103

registering

with Android Backup Service, 408

backup agents in application manifest files, 412

intent filter, 384

to receive broadcasts, 76

dynamically, 76-77

statically, 77

registerListener() method, 258

reinstalling applications, ADB, 451

release() method, 235

remote backup services, 408

remote interfaces, implementing 24-26

remote view, creating App Widgets, 370-371

RemoteViews object, 373

rendering to custom view control, 350-352

RenderScript, 345-346

versus Android NDK, 363

defining functionality, 346-350

rendering to custom view control, 350-352

RenderScriptGL object, 349

reports

eCommerce reports, reviewing, 437

error reports, ProGuard, 444

requesting

backups, 412

call state, 240-242

OpenGL ES 2.0 surfaces, 341-345

restores, 413

searches, 390-391

service information, 242

restore operations, forcing (ADB), 456

restores, requesting, 413

retrieving

Android network status, 179-180

content provider data with CursorLoader, 68-69

files to devices or emulators, 450

gallery images, 71

return values, Android NDK, 359-360

reviewing eCommerce reports, 437

ringtones, 238

root(), 347-348

rotating transformations, animations, 307

rsgClearColor(), 348

RSSurfaceView class, 350

S

saving images to databases, 71

ScaleGestureDetector, 132, 140

scaling bitmap graphics, 287

scaling transformations, animations, 308

ScanResult object, 275

scenes, lighting, 329-330

schema objects, creating SQLite, 37-38

screen orientation changes, 144-146

screen requirements, text, 287

screen space, device diversity, 161-162

screens that do not require action bars, 114

scroll gesture, 133

ScrubActivity class, 112

SDK (Software Development Kit), 17

search activity, creating, 392-394

search configurations, creating, 387

search suggestions, enabling, 387-390

searches

Android manifest files, configuring, 394-395

basic searches, enabling, 387

creating configurations, 387

enabling in applications, 386-387

global search

enabling, 395

updating search configurations, 396

updating search setting, 397

making application content searchable, 385-386

requesting, 390-391

suggestions, enabling, 387-390

voice search, enabling, 390

searching multimedia, 236-237

secondary logs, acessing (LogCat), 455

secure coding practices, software piracy, 442

securing application broadcasts, 80

SELECT, querying tables (SQLite), 471

sending

Android Beam, 270-271

broadcasts, 73-74

files to devices or emulators, 450

SMS, 245-246

sendMultipartTestMessage() method, 248

sensor data, reading, 256-257

SensorManager class, 255

sensors. See device sensors

sequential tweened animations, 305

service information, requesting, 242

service lifecycle, 18

<service> tags, 23

services

controlling, 23-24

creating, 18-23

determining when to use, 17

lifecycles of, 18

Session Initiated Protocol (SIP), 251

setAccuracy() method, 199

setAnchorView() method, 231

setARGB() method, 281

setColor() method, 281

setDisplayHomeAsUpEnabled() method, 113

setImageURI() method, 70

setInitialScale() method, 186

setInterpolator() method, 314

setMediaController() method, 231

setNotificationUri() method, 60

setOnFocusChangeListener() method, 130

setOnNdefPushCompleteCallback() method, 271

setShader() method, 282

setTables() method, 60

setTheme(), 119

SGI (Silicon Graphics), 315

Shape class, 289

shape drawables, defining

programmatically, 290

as XML resources, 289

ShapeDrawable class, 289

shapes, 289

defining shape drawables

as XML resources, 289

programmatically, 290

drawing, 291

arcs, 294-295

ovals and circles, 293-294

paths, 295-297

rectangles and squares, 291

rectangles with rounded corners, 291-293

sharing

audio, 236

images, 226-227

shell, ADB (inspecting SQLite databases), 456

shell commands, issuing, 449-450

shell sessions, 449

shells, stress testing applications (ADB), 456-458

Short Message Service. See SMS

signal strength, monitoring, 243

signing up for C2DM, 401

Silicon Graphics (SGI), 315

SimpleCursorAdapter, binding data, 51-54

SimpleDataUpdateService class, 372

simultaneous tweened animations, 305

single-touch gestures, 132-138

SIP (Session Initiated Protocol), 251

SMS (Short Message Service), 239, 244

gaining permission to send and receive messages, 244

receiving, 247-248

sending, 245-246

SmsManager.divideMessage() method, 248

software keyboards, 123, 126

choosing, 124-125

software piracy, 441

anti-piracy tips, 445-446

configuring ProGuard for your apps, 443-444

leveraging License Verification Library, 444-445

obfuscating with ProGuard, 442-443

error reports, 44

secure coding practices, 442

speak() method, 157

speech recognition, 149-154

SQLite, 463

executing commands on command line, 468

importing/exporting databases, 466-468

limitations of, 469

sqlite3 command-line interface, 464

connecting to SQLite databases, 464

exploring databases, 465-466

launching ADB shell, 464

sqlite3 commands, 469

student grade database example, 469

altering and updating data in tables, 473

calculated columns, 474-476

creating tables with AUTOINCREMENT, 470

deleting tables, 476

designing, 470

foreign keys and composite primary keys, 472

inserting data into tables, 471

querying multiple tables with JOIN, 474

querying tables with SELECT, 471

subqueries for calculated columns, 476

SQLite database instances, deleting with application context, 47

SQLite databases

closing, 47

configuring properties, 37

creating, 36

instances with application context, 36

tables and schema objects, 37-38

deleting tables and objects, 47

inspecting with shell, 456

queries, executing, 44

raw queries, 46

with SQLiteQueryBuilder, 45

querying, 41

cursors, 41-42

iterating rows of query results and extracting data, 42-43

storing structured data, 35-36

transactions, 40-41

sqlite3 command-line interface, 464

connecting to SQLite databases, 464

exploring databases, 465-466

launching ADB shell, 464

sqlite3 commands, 469

SQLiteDatabase class

deleting records, 39

inserting records, 38

updating records, 39

SQLiteOpenHelper class, 48-49

SQLiteQueryBuilder, executing queries, 45

squares, drawing, 291

startActivity() method, 250

startActivityForResult() method, 154

startDiscovery() method, 265

starting

ADB server process, 448

OpenGL ES threads, 319-321

startManagingCursor(), 42

startService() method, 18

startSmoothZoom() method, 226

statistics, gathering with Google Analytics, 438-439

status bar, notifications, 84-85

NotificationManager service, 85

text notifications with icons, 85-86

stdio sprintf() call, 359

still images, capturing with cameras, 220-225

stop() method, 235

stopping ADB server process, 448

stopScan() method, 274

stopSelf() method, 18, 22

stopService() method, 24

stopSmoothZoom() method, 226

storing structured data with SQLite databases, 35-36

stress testing applications, shell (ADB), 456-458

strict mode, 14-15

networking, 170

structured data, storing with SQLite databases, 35-36

student grade database example, 469

altering and updating data in tables, 473

calculated columns, 474-476

creating tables with AUTOINCREMENT, 470

deleting tables, 476

designing, 470

foreign keys and composite primary keys, 472

inserting data into tables, 471

querying multiple tables with JOIN, 474

querying tables with SELECT, 471

subqueries for calculated columns, 476

style inheritance, leveraging, 117-119

styles, 114

creating, 115-117

leveraging style inheritance, 117-119

Paint, 281

subqueries for calculated columns, SQLite, 476

@SuppressWarnings option, 362

surfaceChanged() method, 351

surfaces, requesting OpenGL ES 2.0 surfaces, 341-345

SurfaceView, OpenGL ES, 318-319

sweep gradients, 283

sync adapters, synchronizing data, 406-407

synchronizing data with sync adapters, 406-407

system broadcasts, 77-79

T

tables

altering and updating data, SQLite, 473

creating with AUTOINCREMENT (SQLite), 470

deleting in SQLite, 476

inserting data, SQLite, 471

querying with SELECT (SQLite), 471

querying multiple, with JOIN (SQLite), 474

SQLite database, creating, 37-38

SQLite databases, deleting, 47

tablets, developing applications for, 162-163

tags, 384

telephony utilities, 239

gaining permission to access phone state information, 240

monitoring signal strength and data connection speed, 243

phone calls

making, 248-250

receiving, 251

phone numbers, 243-244

requesting call state, 240-242

requesting service information, 242

SIP (Session Initiated Protocol), 251

SMS, 244

gaining permission to send and receive messages, 244

receiving, 247-248

sending, 245-246

TelephonyManager, 240

text, 284

default fonts and typefaces, 284-285

screen requirements, 287

typefaces, custom, 285-286

text notifications with icons, 85-86

text prediction, 126

Text-To-Speech services (TTS), 149, 155-157

TextToSpeech.OnInitListener, 156

textual input methods, 123

clipboard, 126

copying data to, 127

pasting data to, 127

software keyboards, 123, 126

choosing, 124-125

text prediction, 126

user dictionaries, 126

texturing objects, 331-332

themes, 119-121

Thread class, 13-14, 175-176

threads

application threads, talking to OpenGL threads, 335-337

enabling OpenGL threads to talk to application threads, 333-334

OpenGL ES, starting, 319-321

toggleFPSDisplay() method, 336

touch mode, listening for changes, 127-128

trackballs, 143

tracking ad and market referrals, 438

trackTransactions() method, 437

transactions, SQLite databases, 40-41

transformations, tweened animation

moving transformations, 308

rotating transformations, 307

scaling transformations, 308

transparency transformations, 307

transforming bitmaps with matrixes, 287-288

transparency transformations, animations, 307

true north, finding, 258

tweened animation, 304-305

loading, 306

moving transformations, 308

programmatically, 305

rotating transformations, 307

scaling transformations, 308

transparency transformations, 307

as XML resources, 304

typefaces, 284-285

custom, 285-286

TYPE_ACCELEROMETER, 255

TYPE_AMBIENT_TEMPERATURE, 255

TYPE_LIGHT, 255

TYPE_MAGNETIC_FIELD, 255

TYPE_PRESSURE, 255

TYPE_PROXIMITY, 255

TYPE_RELATIVE_HUMIDITY, 255

U

uninstalling applications, ADB, 452

update services, App Widgets, 372-373

update() method, content providers, 62-63

updating

App Widgets, 372

data in tables, SQLite, 473

manifest files, 65

notifications, 88-89

records, SQLiteDatabase class, 39

search configurations for global searches, 396

search settings for global searches, 397

UriMatcher, 59-61

URIs, locating content on Android systems, 67

USB, 267

accessories, 268

hosts, 269

UsbManager class, 268

user dictionaries, 126

user events, 127

listening for

events on the entire screen, 128-129

focus changes, 130-131

long clicks, 129-130

touch mode changes, 127-128

user interface guidelines, 99

user interfaces

action bars, 105-106

advanced features, 114

application icon clicks, 112-113

contextual action mode, 114

creating basic, 106-109

customizing, 110-111

screens that do not require action bars, 114

binding data to, 50-51

menus, 100

context menus, 103-105

options menus, 100-103

popup menus, 105

styles, 114

creating, 115-117

leveraging style inheritance, 117-119

themes, 119-121

user motions, detecting within views, 131-132

users

attracting with device diversity, 161

notifying, 83-84

V

vertices, coloring, 326

vibrating phones, notifications, 91-92

vibration patterns, 91

video, 229

playing, 231

recording, 229-230

videoRecorder object, 230

view animation, 304

views

detecting user motions, 131-132

mapping, 206-207

ViewTreeObserver class, 128

voice search, enabling, 390

W

wallpaper, assigning images, 227-228

web

browsing with WebView, 183-184

reading data from, 170-171

web applications, optimizing for Google TV, 165

web extensions, building with WebKit, 190

WebChromeClient, adding browser chrome, 188-189

WebChromeClient class, 192

WebKit

APIs, browsing, 190

building web extensions, 190

extending functionality to Android, 190-195

WebSettings, modifying WebView settings, 186

WebView

adding features to, 186

browsing the web, 183-184

designing layouts, 184

handling events with WebViewClient, 186-187

loading content into, 184-186

managing, 189

modifying settings with WebSettings, 186

WebViewClient, handling WebView events, 186-187

Wi-Fi, 273

monitoring, 274-276

Wi-Fi Direct, 273

Wi-Fi Direct, 273

WifiConfiguration object, 276

WifiManager object, 276

wiping, archived data (ADB), 456

world Magnetic Model, 258

writeToParcel() method, 28

X-Y

XML, parsing from the network, 172-174

XML resources

property animations, 310-311

shape drawables, 289

tweened nimations, 304

XMPP (Extensible Messaging and Presence Protocol), 403

Z

zooming

cameras, 226

map view, 210

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.234.118