The fun and friendly guide to creating applications on the Android platform The popularity of the Android market is soaring with no sign of slowing down. The open nature of the Android OS offers programmers the freedom to access the platform's capabilities and this straightforward guide walks you through the steps for creating amazing Android applications. Android programming expert Donn Felker explains how to download the SDK, get Eclipse up and running, code Android applications, and submit your finished products to the Android Market. Featuring two sample programs, this introductory book explores everything from the simple basics to more advanced aspects of the Android platform. Takes you soup through nuts of developing applications for the Android platform Begins with downloading the SDK, then explains how to code Android applications and submit projects to the Android Market Written by Android guru Donn Felker, who breaks every aspect of developing applications for the Android platform into easily digestible pieces No matter your level of programming experience, Android Application Development For Dummies is an ideal guide for getting started with developing applications for the Android platform. Android Application Development For Dummies® 1 About the Authors 7 Dedication 9 Author’s Acknowledgments 11 Contents at a Glance 13 Table of Contents 15 Introduction 23 About This Book 23 Conventions Used in This Book 24 Foolish Assumptions 25 How This Book Is Organized 25 Icons Used in This Book 26 Where to Go from Here 27 Part I: The Nuts and Bolts of Android 29 Chapter 1: Developing Spectacular Android Applications 31 Why Develop for Android? 31 Android Programming Basics 35 Hardware Tools 40 Software Tools 42 Chapter 2: Prepping Your Development Headquarters 47 Developing the Android Developer Inside You 47 Assembling Your Toolkit 48 Tuning Up Your Hardware 53 Installing and Configuring Your Support Tools 54 Getting the Java Development Kit 55 Acquiring the Android SDK 57 Getting the Total Eclipse 63 Getting Acquainted with the Android Development Tools 69 Part II: Building and Publishing Your First Android Application 75 Chapter 3: Your First Android Project 77 Starting a New Project in Eclipse 77 Deconstructing Your Project 83 Setting Up an Emulator 87 Creating Launch Configurations 90 Running the Hello Android App 94 Understanding Project Structure 100 Chapter 4: Designing the User Interface 115 Creating the Silent Mode Toggle Application 116 Laying Out the Application 117 Developing the User Interface 124 Adding an Image to Your Application 126 Creating a Launcher Icon for the Application 130 Adding a Toggle Button Widget 133 Previewing the Application in the Visual Designer 135 Chapter 5: Coding Your Application 139 Understanding Activities 139 Creating Your First Activity 144 Working with the Android Framework Classes 150 Installing Your Application 155 Reinstalling Your Application 159 Uh-oh!: Responding to Errors 160 Thinking Beyond Your Application Boundaries 173 Chapter 6: Understanding Android Resources 177 Understanding Resources 177 Working with Resources 180 Chapter 7: Turning Your Application into a Home-Screen Widget 185 Working with App Widgets in Android 186 Working with Pending Intents 189 Creating the Home-Screen Widget 194 Placing Your Widget on the Home Screen 206 Chapter 8: Publishing Your App to the Android Market 209 Creating a Distributable File 209 Creating an Android Market Account 216 Pricing Your Application 222 Getting Screen Shots for Your Application 223 Uploading Your Application to the Android Market 225 Watching the Installs Soar 229 Part III: Creating a Feature-Rich Application 231 Chapter 9: Designing the Task Reminder Application 233 Reviewing the Basic Requirements 233 Creating the Application’s Screens 235 Creating Your First List Activity 242 Identifying Your Intent 246 Chapter 10: Going a la Carte with Your Menu 253 Seeing What Makes a Menu Great 254 Creating Your First Menu 254 Creating a Context Menu 258 Chapter 11: Handling User Input 263 Creating the User Input Interface 263 Getting Choosy with Dates and Times 266 Creating Your First Alert Dialog Box 274 Validating Input 279 Chapter 12: Getting Persistent with Data Storage 283 Finding Places to Put Data 283 Asking the User for Permission 286 Creating Your Application’s SQLite Database 288 Creating and Editing Tasks with SQLite 294 Chapter 13: Reminding the User with AlarmManager 313 Seeing Why You Need AlarmManager 313 Waking Up a Process with AlarmManager 314 Rebooting Devices 321 Chapter 14: Updating the Android Status Bar 325 Deconstructing the Status Bar 325 Using the Notification Manager 329 Updating a Notification 332 Clearing a Notification 333 Chapter 15: Working with Android’s Preference Framework 335 Understanding Android’s Preference Framework 336 Understanding the PreferenceActivity Class 336 Creating Your First Preference Screen 339 Working with the PreferenceActivity Class 342 Working with Preferences in Your Activities at Run Time 345 Part IV: The Part of Tens 351 Chapter 16: Ten Great Free Sample Applications and SDKs (With Code!) 353 The Official Foursquare App 354 LOLCat 354 Amazed 355 APIDemos 355 MultipleResolutions Example 355 Last.fm App Suite 356 Hubroid 356 Facebook SDK for Android 356 Replica Island 357 Notepad Tutorial 357 Chapter 17: Ten Tools That Make Your Developing Life Easier 359 droid-fu 359 RoboGuice 360 DroidDraw 360 Draw 9-patch 360 Hierarchy Viewer 360 UI/Application Exerciser Monkey 361 zipalign 361 layoutopt 361 Git 361 Paint.NET and GIMP 362 Index 363