Android Application Development Cookbook: 93 Recipes for Building Winning Apps
Buy Rights Online Buy Rights

Rights Contact Login For More Details

  • Wiley

More About This Title Android Application Development Cookbook: 93 Recipes for Building Winning Apps

English

A must-have collection of ready-to-use Android recipes!

The popularity of Google Android devices is seemingly unstoppable and the Android 4 release offers, for the first time, a single OS solution for building both phone and tablet applications. With that exciting information in mind, veteran author Wei-Meng Lee presents you with 100 unique recipes that you can apply today in order to discover solutions to some of the most commonly encountered problems that exist in Android programming.

Covering the scope of multiple Android releases up through Android 4, this reference features a task description, followed by the solution(s) available, and a standalone project file that illustrates the use of the recipe. Formatting each recipe to be standalone, Wei-Meng Lee allows you to jump into the relevant recipe to find a solution to specific challenges.

Identifies and describes a programming task, provides a step-by-step solution, and presents a full-code solution ready for downloadCovers multiple Android releasesAddresses such topics as user interfaces, telephony and messaging, networking, Google maps, location-based services, persisting data, leveraging hardware features, and more

Android Application Development Cookbook is your solution to discovering...solutions!

English

Wei-Meng Lee is the founder of Developer Learning Solutions (www.learn2develop.net), a technology company specializing in hands-on training in the latest Microsoft and Apple technologies. He writes extensively for online publications and is also the author of Beginning Android 4 Application Development and Beginning iOS 5 Application Development.

Wrox guides are crafted to make learning programming languages and technologies easier than you think. Written by programmers for programmers, they provide a structured, tutorial format that will guide you through all the techniques involved.

English

Introduction xv

Chapter 1: Android Fundamentals 1

Recipe 1.1 Linking Activities 1
Solution 2

Recipe 1.2 Passing Data between Activities 5
Solution 6

Recipe 1.3 Passing Objects between Activities 11
Solution 11

Recipe 1.4 Sending and Receiving Broadcasts 13
Solution 14

Recipe 1.5 Assigning Priorities to Broadcast Receivers 18
Solution 19

Recipe 1.6 Auto-Launching Your Application at Boot Time 21
Solution 21

Recipe 1.7 Calling Built-In Apps 22
Solution 23

Recipe 1.8 Making Your Application Callable by Others 32
Solution 32

Chapter 2: Using Views to Design the User Interface 39

Recipe 2.1 Using Buttons 40
Solution 40

Recipe 2.2 Using Image Buttons 44
Solution 44

Recipe 2.3 Using Radio Buttons 46
Solution 46

Recipe 2.4 Using CheckBoxes 49
Solution 50

Recipe 2.5 Implementing a Star Rating System 52
Solution 52

Recipe 2.6 Using AutoCompleteTextView 55
Solution 55

Recipe 2.7 Displaying Web Pages 57
Solution 58

Recipe 2.8 Using the TimePicker 62
Solution 62

Recipe 2.9 Using the DatePicker 64
Solution 65

Recipe 2.10 Using LinearLayout for View Positioning 66
Solution 67

Recipe 2.11 Using RelativeLayout for View Positioning 72
Solution 72

Recipe 2.12 Using FrameLayout for View Positioning 74
Solution 74

Recipe 2.13 Using TableLayout for View Positioning 77
Solution 77

Recipe 2.14 Using the ScrollView 79
Solution 79

Recipe 2.15 Displaying Context and Options Menus 83
Solution 83

Recipe 2.16 Displaying Dialogs 90
Solution 91

Recipe 2.17 Implementing Paging 98
Solution 98

Chapter 3: Displaying Lists of Items and Images 105

Recipe 3.1 Displaying a List of Items Using the ListView 106
Solution 106

Recipe 3.2 Customizing the ListView 108
Solution 108

Recipe 3.3 Displaying Multiple ListViews 111
Solution 111

Recipe 3.4 Creating Custom ListViews 114
Solution 115

Recipe 3.5 Further Customizing Each Row with Additional TextViews 117
Solution Part One: Adding Additional TextViews 118
Solution Part Two: Recycling Each Row 122

Recipe 3.6 Displaying a List of Items Using the Spinner View 125
Solution 126

Recipe 3.7 Displaying a List of Images 128
Solution 129

Recipe 3.8 Animating the Changing of Images Using the ImageSwitcher 133
Solution 133

Recipe 3.9 Displaying Images Using the GridView 138
Solution 138

Recipe 3.10 Building a Master-Detail User Interface 141
Solution 143

Chapter 4: Telephony 151

Recipe 4.1 Calling from Your Application 151
Solution 152

Recipe 4.2 Monitoring the State of the Phone 153
Solution 153

Recipe 4.3 Monitoring Phone State in the Background 156
Solution 156

Recipe 4.4 Blocking Outgoing Calls 158
Solution 159

Recipe 4.5 Auto-Answering an Incoming Call 160
Solution 160

Recipe 4.6 Switching to Airplane Mode 163
Solution 163

Recipe 4.7 Getting the Phone Number, IMEI, and SIM Card ID 165
Solution 166

Recipe 4.8 Enabling Bluetooth 167
Solution 167

Recipe 4.9 Displaying the Call Log 173
Solution 173

Chapter 5: Messaging 175

Recipe 5.1 Sending SMS Messages Through the Built-in Messaging Application 175
Solution 176

Recipe 5.2 Sending SMS Messages Programmatically in Your Android Application 178
Solution 178

Recipe 5.3 Monitoring the Status of Sent SMS Messages Programmatically 179
Solution 180

Recipe 5.4 Monitoring Outgoing SMS Messages 183
Solution 184

Recipe 5.5 Intercepting Incoming SMS Messages 187
Solution 187

Chapter 6: Network Programming 191

Recipe 6.1 Connecting to Servers Using HTTP GET 191
Solution 192

Recipe 6.2 Connecting to Servers Using HTTP POST 195
Solution 195

Recipe 6.3 Downloading Binary Data Using HTTP 198
Solution 199

Recipe 6.4 Consuming XML Web Services 200
Solution 201

Recipe 6.5 Consuming JSON Web Services 204
Solution 205

Recipe 6.6 Getting the IP Address of the Device 210
Solution 211

Recipe 6.7 Creating a Socket Server 212
Solution 212

Recipe 6.8 Creating a Socket Client 218
Solution 218

Recipe 6.9 Checking for the Availability of Bluetooth 222
Solution 222

Recipe 6.10 Monitoring the State of Bluetooth 224
Solution 225

Recipe 6.11 Creating a Bluetooth Chat Application 226
Solution 227

Chapter 7: Using Google Maps 243

Recipe 7.1 Displaying Google Maps 243
Solution 244

Recipe 7.2 Zooming in and out of Google Maps 250
Solution 250

Recipe 7.3 Changing Map Modes 253
Solution 253

Recipe 7.4 Navigating the Map to a Particular Location 256
Solution 256

Recipe 7.5 Adding Markers to the Map 258
Solution 258

Recipe 7.6 Finding a User-Friendly Address Using Reverse Geocoding, and Vice Versa 268
Solution 268

Recipe 7.7 Responding to Zooming and Panning 275
Solution 275

Chapter 8: Location-Based Data Services 279

Recipe 8.1 Obtaining Geographical Location Using GPS, Wi-Fi, or Cellular Networks 280
Solution 280

Recipe 8.2 Choosing the Best Location Provider to Use 284
Solution 284

Recipe 8.3 Monitoring a Location 288
Solution 288

Recipe 8.4 Using a BroadcastReceiver to Obtain Locations 289
Solution 290

Recipe 8.5 Location Data Logging 293
Solution 293

Chapter 9: Acc essing the Hardware 301

Recipe 9.1 Capturing Pictures with the Camera 301
Solution 301

Recipe 9.2 Detecting the Presence of Hardware Features 304
Solution 305

Recipe 9.3 Checking Network State 306
Solution 306

Recipe 9.4 Turning GPS On/Off 308
Solution 308

Recipe 9.5 Capturing Hardware Buttons Programmatically 310
Solution 310

Recipe 9.6 Switching on the Flashlight 313
Solution 314

Recipe 9.7 Capturing Barcodes 319
Solution 320

Chapter 10: Persisting Data 325

Recipe 10.1 Saving and Loading User Preferences 325
Solution 326

Recipe 10.2 Creating a Preference Screen 328
Solution 328

Recipe 10.3 Saving Files to the Data Directory 333
Solution 333

Recipe 10.4 Saving Files to the Cache Directory 338
Solution 338

Recipe 10.5 Saving Files to External Storage 340
Solution 341

Recipe 10.6 Attaching Files to Your Project 345
Solution 346

Recipe 10.7 Creating and Using SQLite Databases Programmatically 347
Solution 348

Recipe 10.8 Pre-creating the SQLite Databases 353
Solution 353

Chapter 11: Deploying Your Android Applications 357

Recipe 11.1 Localizing Your Application 357
Solution 358

Recipe 11.2 Exporting Your Application as an APK File 362
Solution 362

Recipe 11.3 Deploying Your App Through E-mail 365
Solution 365

Recipe 11.4 Deploying Your App Through the Web 367
Solution 368

Recipe 11.5 Deploying Your App Through an SD Card 369
Solution 369

Recipe 11.6 Specifying the Application Installation Location 370
Solution 371

Index 373

loading