Thursday, July 19, 2012

Professional Android Application Development Free Download Mediafire LInk


Size : 7.4 MB

Chapter 1: Hello, Android 1

A Little Bac kground 2
The Not So Distant Past 2
The Future 3
What It Is n’t 3
An Open Platform for Mobile Development 4
Native Android Ap plications 4
Android SDK Features 5
Access to Hardware including Camera, GPS, and Accelerometer 6
Native Google Maps, Geocoding, and Location-Based Services 6
Background Services 6
SQLite Database for Data Storage and Retrieval 7
Shared Data and Interapplication Communication 7
P2P Services with Google Talk 7
Extensive Media Support and 2D/3D Graphics 8
Optimized Memory and Process Management 8
Introducing the Op en Handset Allia nce 8
What Doe s Android Run O n? 9
Why Develop for Android? 9
What Will Drive Android Adoption? 10
What Does It Have That Others Don’t? 10

Changing the Mobile Development Landscape 11
Introducing the De velopment Framework 11
What Comes in the Box 12
Understanding the Android Software Stack 12
The Dalvik Virtual Machine 14
Android Application Architecture 14
Android Libraries 15
Advanced Android Libraries 16
Summary 17
x
Contents

Chapter 2: Getting Star ted 19

Developing for Android 20
What You Need to Begin 20
Creating Your First Android Activity 24
Types of Android Applications 29
Developing for Mobile Devices 30
Hardware-Imposed Design Considerations 30
Considering the Users’ Environment 33
Developing for Android 34
To-Do List E xample 37
Android Development Tools 42
The Android Emulator 42
Dalvik Debug Monitor Service (DDMS) 43
The Android Debug Bridge (ADB) 43
Summary 44

Chapter 3: Creating Applications and Activities 45

What Mak es an Android Ap plication? 46
Introducing the Ap plication Ma nifest 46
Using the Ma nifest Edit or 49
The Android Ap plication Life Cycle 50
Understanding Application Priority and Process Stat es 51
Externalizing Resources 52
Creating Resources 53
Using Resources 59
To-Do List Resources Example 62
Creating Resources for Different Languages and Hardware 63
Runtime Confi guration Changes 64
A Closer L ook at Android A ctivities 66
Creating an Activity 66
The Activity Life Cycle 68
Android Activity Classes 73
Summary 73

Chapter 4: Creating User Interfaces 75

Fundamental Android U I Design 76
Introducing Vie ws 76
Creating Activity User Interfaces with Views 77
The Android Widget Toolbox 78
xi
Contents
Introducing L ayouts 79
Using Layouts 79
Creating New Views 80
Modifying Existing Views 81
Creating Compound Controls 85
Creating Custom Widgets and Controls 88
Using Custom Controls 98
Creating and Using Menu s 99
Introducing the Android Menu System 99
Defi ning an Activity Menu 101
Dynamically Updating Menu Items 104
Handling Menu Selections 104
Submenus and Context Menus 105
To-Do List Example Continued 107
Summary 1 12

Intents, Chapter 5: Broadcast Receivers, Adapters, and the Int ernet 113

Introducing Intents 114
Using Intents to Launch Activities 114
Using Intent Filters to Service Implicit Intents 121
Using Intent Filters for Plug-ins and Extensibility 130
Using Intents to Broadcast Events 132
Introducing Adapters 136
Introducing Some Android-Supplied Adapters 136
Using Adapters for Data Binding 136
Using Internet Resources 141
Connecting to an Internet Resource 142
Leveraging Internet Resources 143
Introducing D ialogs 143
Introducing the Dialog Class 144
Using Activities as Dialogs 147
Creating a n Earthquake Viewer 148
Summary 1 57

Chapter 6: Data Storage, Retrieval, and Sharing 159

Android Techniques for Saving Data 160
Saving Simple Application Data 160
Creating and Saving Preferences 161
Retrieving Shared Preferences 161
Saving the Activity State 162
Creating a Preferences Page for the Earthquake Viewer 165
xii
Contents
Saving and Loading Files 174
Including Static Files as Resources 174
File Management Tools 175
Databases in Android 175
Introducing SQLite 176
Cursors and Content Values 176
Working with Android Databases 177
Introducing Cont ent Providers 189
Using Content Providers 189
Native Android Content Providers 192
Creating a New Content Provider 194
Creating and Using an Earthquake Content Provider 197
Summary 205

Maps, G Chapter 7: eocoding, and Location-Based Services 207

Using Location-Based Services 208
Setting up the E mulator with T est P roviders 208
Updating Locations in Emulator Location Providers 208
Create an Application to Manage Test Location Providers 209
Selecting a L ocation P rovider 212
Finding the Available Providers 212
Finding Providers Based on Requirement Criteria 212
Finding Your Location 213
“Where Am I?” Example 214
Tracking Movement 216
Updating Your Location in “Where Am I?” 217
Using Proximity Aler ts 219
Using the G eocoder 220
Reverse Geocoding 221
Forward Geocoding 221
Geocoding “Where Am I?” 222
Creating Map -Based A ctivities 224
Introducing MapView and MapActivity 224
Creating a Map-Based Activity 224
Confi guring and Using Map Views 226
Using the Map Controller 227
Mapping “Where Am I?” 228
Creating and Using Overlays 231
Introducing MyLocationOverlay 239
Introducing ItemizedOverlays and OverlayItems 239
Pinning Views to the Map and Map Positions 240
xiii
Contents
Mapping Earthquakes Example 242
Summary 2 47

Chapter 8: Working in the Bac kground 249

Introducing Services 250
Creating and Controlling Services 250
Binding Activities to Services 258
Using Background Worker Threads 259
Creating New Threads 260
Synchronizing Threads for GUI Operations 260
Moving the Earthquake Service to a Background Thread 261
Let’s Make a Toast 262
Customizing Toasts 263
Using Toasts in Worker Threads 264
Introducing Noti f cations 265
Introducing the Notifi cation Manager 266
Creating Notifi cations 266
Triggering Notifi cations 267
Adding Notifi cations to the Earthquake Monitor 267
Advanced Notifi cation Techniques 270
Ongoing and Insistent Notifi cations 272
Using Alarms 273
Using Alarms to Update Earthquakes 274
Summary 276

Chapter 9: Peer-to-Peer Communication 279

Introducing Android In stant Me ssaging 280
Using the GTalk Service 280
Binding to the GTalk Service 281
Making a GTalk Connection and Starting an IM Session 282
Introducing Presence and the Contact Roster 283
Managing Chat Sessions 286
Sending and Receiving Data Messages 289
Introducing SMS 291
Using SMS in Your Application 291
Sending SMS Messages 292
Listening for SMS Messages 294
Emergency Responder SMS Example 297
Automating the Emergency Responder 306
Summary 31 4
xiv
Contents

Chapter 10: Accessing Android Hardware 315

Using the Media APIs 316
Playing Media Resources 316
Recording Multimedia 317
Using the Ca mera 319
Controlling Camera Settings 319
Using the Camera Preview 320
Taking a Picture 320
Introducing the Sen sor Manager 321
Using the A ccelerometer and Compass 323
Introducing Accelerometers 324
Detecting Acceleration Changes 324
Creating a Speedometer 326
Determining Your Orientation 329
Creating a Compass and Artifi cial Horizon 330
Android Telephony 333
Making Phone Calls 334
Monitoring Phone State and Phone Activity 334
Monitoring Data Connectivity and Activity 337
Accessing Phone Properties and Status 338
Controlling the Phone 338
Using Bluetooth 339
Introducing the Bluetooth Service 339
Controlling the Local Bluetooth Device 340
Discovering and Bonding with Bluetooth Devices 340
Managing Bluetooth Connections 342
Communication with Bluetooth 342
Using a Bluetooth Headset 344
Managing Net work and Wi-Fi Connection s 345
Monitoring and Managing Your Internet Connectivity 345
Managing Active Connections 346
Managing Your Wi-Fi 347
Controlling Device Vibration 350
Summary 3 51


Chapter 11: Advanced Android De velopment 353

Paranoid Android 354
Linux Kernel Security 354
Introducing Permissions 354
Declaring and Enforcing Permissions 355
Enforcing Permissions with Broadcasting Intents 355
xv
Contents
Using AID L to Support IP C for Services 356
Implementing an AIDL Interface 356
Using Internet Ser vices 361
Building Rich U ser Interfaces 361
Working with Animations 361
Using Themes to Skin Your Applications 372
Advanced Canvas Drawing 373
Introducing SurfaceView 390
Creating Interactive Controls 393
Summary 398
Index 399

No comments:

Post a Comment