Learning Android Application Programming for the Kindle Fire
Addison-Wesley Educational Publishers Inc (Verlag)
978-0-321-83397-6 (ISBN)
- Titel ist leider vergriffen;
keine Neuauflage - Artikel merken
In this book, bestselling Android programming authors Lauren Darcey and Shane Conder teach you every skill and technique you need to write production-quality apps for Amazon Kindle Fire, the world’s hottest Android tablet. You’ll learn the very best way: by building a complete app from start to finish. Every chapter builds on what you’ve already learned, helping you construct, expand, and extend your working app as you move through the entire development lifecycle.
Packed with fully tested, reusable sample code, this book requires absolutely no previous Android or mobile development experience. If you’ve ever written any Java code, you can dive right in and get results fast. Darcey and Conder start with the absolute basics: installing Android development tools, structuring and configuring Kindle Fire apps, and applying crucial design principles associated with high-quality software. Next, building on this strong foundation, you’ll learn how to manage application resources and build application frameworks; integrate user interfaces, logic, and support for networking and web services; test your apps; and publish on the Amazon Appstore.
Coverage includes
Establishing an efficient development environment and setting up your first project
Mastering Android fundamentals and adapting them to the Kindle Fire
Building reusable prototypes that define a framework for production projects
Incorporating strings, graphics, styles, templates, and other app and system resources
Developing screens, from splash screens and main menus to settings and help
Displaying dialogs and collecting user input
Controlling app state, saving settings, and launching specific activities
Internationalizing Kindle Fire apps to reach wider markets
Setting application identity and permissions
Preparing your app for publication
Lauren Darcey is responsible for the technical leadership and direction of a small software company specializing in mobile technologies, including Android, Apple iOS, BlackBerry, Palm Pre, BREW, and J2ME and consulting services. With more than two decades of experience in professional software production, Lauren is a recognized authority in application architecture and the development of commercial-grade mobile applications. Lauren received a B.S. in Computer Science from the University of California, Santa Cruz. Lauren spends her free time traveling the world with her geeky mobile-minded husband and daughter. She is an avid nature photographer whose work has been published in books and newspapers around the world. In South Africa, she dove with 4-meter-long great white sharks and got stuck between a herd of rampaging hippopotami and an irritated bull elephant. She`s been attacked by monkeys in Japan, gotten stuck in a ravine with two hungry lions in Kenya, gotten thirsty in Egypt, narrowly avoided a coup d`état in Thailand, geocached her way through the Swiss Alps, drank her way through the beer halls of Germany, slept in the crumbling castles of Europe, and gotten her tongue stuck to an iceberg in Iceland (while being watched by a herd of suspicious wild reindeer). Shane Conder has extensive development experience and has focused his attention on mobile and embedded development for the past decade. He has designed and developed many commercial applications for Android, Apple iOS, BREW, BlackBerry, J2ME, Palm, and Windows Mobile—some of which have been installed on millions of phones worldwide. Shane has written extensively about the mobile industry and evaluated mobile-development platforms on his tech blogs and is well known within the blogosphere. Shane received a B.S. in Computer Science from the University of California. A self-admitted gadget freak, Shane always has the latest smartphone, tablet, or other mobile device. He can often be found fiddling with the latest technologies, such as cloud services and mobile platforms, and other exciting, state-of-the-art technologies that activate the creative part of his brain. He is a very hands-on geek dad. He also enjoys traveling the world with his geeky wife, even if she did make him dive with 4-meter-long great white sharks and almost get eaten by a lion in Kenya. He admits that he has to take at least two phones with him when backpacking—even though there is no coverage—and that he snickered and whipped out his Android phone to take a picture when Laurie got her tongue stuck to that iceberg in Iceland, and that he has learned that he should be writing his own bio. The authors have also published several other Android books, including Android Wireless Application Development, Android Wireless Application Development Volume I: Android Essentials, Android Wireless Application Development Volume 2: Advanced Topics, Sams Teach Yourself Android Application Development, and the mini-book Introducing Android Development with Ice Cream Sandwich . Lauren and Shane have also published numerous articles on mobile-software development for magazines, technical journals, and online publishers of educational content. You can find dozens of samples of their work in Linux User and Developer, Smart Developer magazine (Linux New Media), developer.com, Network World, Envato (MobileTuts+ and CodeCanyon), and InformIT, among others. They also publish articles of interest to their readers at their own Android website: http://androidbook.blogspot.com. You can find a full list of the authors’ publications at http://goo.gl/f0Vlj .
Introduction 1
I: Kindle Fire Fundamentals
1 Getting Started with Kindle Fire 9
Introducing Android 9
Google and the Open Handset Alliance 9
Android Makes Its Entrance 10
Cheap and Easy Development 10
Familiarizing Yourself with Eclipse 12
Creating Android Projects 13
Exploring Your Android Project Files 16
Editing Project Resources 17
Running and Debugging Applications 20
Managing Android Virtual Devices 20
Creating Debug and Run Configurations in Eclipse 22
Launching Android Applications Using the Emulator 22
Debugging Android Applications Using DDMS 25
Launching Android Applications on a Device 25
Summary 28
Exercises 28
2 Mastering the Android Development Tools 29
Using the Android Documentation 29
Debugging Applications with DDMS 31
Managing Tasks 32
Browsing the Android File System 33
Taking Screenshots of the Emulator or Device 34
Viewing Log Information 35
Working with the Android Emulator 36
Providing Input to the Emulator 36
Using Other Android Tools 36
Summary 36
3 Building Kindle Fire Applications 39
Designing an Android Application 39
Designing Application Features 40
Determining Application Activity Requirements 40
Implementing Application Functionality 41
Using the Application Context 42
Retrieving Application Resources 42
Accessing Application Preferences 42
Accessing Other Application Functionality Using Contexts 43
Working with Activities 43
Launching Activities 43
Managing Activity State 44
Shutting Down Activities 45
Working with Intents 46
Passing Information with Intents 47
Using Intents to Launch Other Applications 47
Working with Dialogs 48
Working with Fragments 49
Logging Application Information 50
Summary 51
Exercises 51
4 Managing Application Resources 53
Using Application and System Resources 53
Working with Application Resources 53
Working with System Resources 56
Working with Simple Resource Values 57
Working with Strings 57
Working with Colors 57
Working with Dimensions 58
Working with Drawable Resources 59
Working with Images 59
Working with Other Types of Drawables 60
Working with Layouts 60
Designing Layouts Using the Layout Resource Editor 61
Designing Layouts Using XML 62
Working with Files 64
Working with XML Files 64
Working with Raw Files 65
Working with Other Types of Resources 66
Summary 66
Exercises 66
5 Configuring the Android Manifest File 69
Exploring the Android Manifest File 69
Using the Manifest Tab 70
Using the Application Tab 71
Using the Permissions Tab 71
Using the Instrumentation Tab 72
Using the AndroidManifest.xml Tab 73
Configuring Basic Application Settings 73
Naming Android Packages 74
Versioning an Application 74
Setting the Minimum Android API Version 75
Naming an Application 76
Providing an Icon for an Application 76
Providing an Application Description 76
Setting Debug Information for an Application 77
Setting Other Application Attributes 77
Defining Activities 77
Registering Activities 77
Designating the Launch Activity 78
Managing Application Permissions 79
Managing Other Application Settings 81
Summary 81
Exercises 81
6 Designing an Application Framework 83
Designing an Android Trivia Game 83
Determining High-Level Game Features 83
Determining Activity Requirements 84
Determining Screen-Specific Game Features 85
Implementing an Application Prototype 90
Reviewing the Accompanying Source Code 90
Creating a New Android Project 90
Adding Project Resources 91
Implementing Application Activities 92
Creating Application Preferences 93
Running the Game Prototype 95
Creating a Debug Configuration 95
Launching the Prototype in the Emulator 95
Exploring the Prototype Installation 96
Summary 97
Exercises 97
II: Building an Application Framework
7 Implementing an Animated Splash Screen 101
Designing the Splash Screen 101
Implementing the Splash Screen Layout 102
Adding New Project Resources 103
Updating the Splash Screen Layout 106
Working with Animation 110
Adding Animation Resources 110
Animating Specific Views 112
Setting the Image Animations 113
Handling Animation Lifecycle Events 114
Summary 115
Exercises 116
8 Implementing the Main Menu Screen 117
Designing the Main Menu Screen 117
Determining Main Menu Screen Layout Requirements 118
Designing the Screen Header 118
Designing the GridView Control 118
Finishing Touches for the Main Menu Layout Design 119
Implementing the Main Menu Screen Layout 119
Adding New Project Resources 120
Updating the Main Menu Screen Layout Files 121
Working with the GridView Control 124
Filling a GridView Control 124
Listening for GridView Events 127
Working with Other Menu Types 128
Adding an Options Menu to the Game Screen 129
Summary 131
Exercises 131
9 Developing the Help and Scores Screens 133
Designing the Help Screen 133
Implementing the Help Screen Layout 135
Adding New Project Resources 135
Updating the Help Screen Layout 135
Working with Files 136
Adding Raw Resource Files 136
Accessing Raw File Resources 137
Designing the Scores Screen 138
Determining Scores Screen Layout Requirements 138
Adding the TabHost Control 139
Implementing the Scores Screen Layout 141
Adding New Project Resources 141
Updating the Scores Screen Layout 142
Building a Screen with Tabs 144
Configuring the TabHost Control 144
Adding Tabs to the TabHost Control 145
Setting the Default Tab 145
Working with XML 146
Retrieving XML Resources 146
Parsing XML Files with XmlResourceParser 146
Applying Finishing Touches to the Scores Screen 147
Summary 148
Exercises 148
10 Collecting User Input 149
Designing the Settings Screen 149
Implementing the Settings Screen Layout 151
Adding New Project Resources 151
Updating the Settings Screen Layout 154
Using Common Form Controls 155
Working with EditText Controls 156
Working with Spinner Controls 159
Saving Form Data with SharedPreferences 161
Defining SharedPreferences Entries 161
Saving Settings to SharedPreferences 161
Reading Settings from SharedPreferences 162
Summary 163
11 Using Dialogs to Collect User Input 165
Working with Activity Dialogs 165
Exploring the Different Types of Dialogs 166
Tracing the Lifecycle of a Dialog 167
Using the DatePickerDialog Class 168
Adding a DatePickerDialog to a Class 168
Initializing a DatePickerDialog 170
Launching DatePickerDialog 170
Working with Custom Dialogs 171
Adding a Custom Dialog to the Settings Screen 172
Summary 178
Exercises 178
12 Adding Application Logic 181
Designing the Game Screen 181
Implementing the Game Screen Layout 183
Adding New Project Resources 184
Updating the Game Screen Layout 185
Working with ViewSwitcher Controls 186
Initializing Switcher Controls 187
Implementing Switcher Factory Classes 187
Updating the TextSwitcher Control 189
Updating the ImageSwitcher Control 189
Wiring Up Game Logic 190
Adding Game State Settings to the SharedPreferences 191
Retrieving, Parsing, and Storing Book Data 192
Summary 197
Exercises 197
13 Adding Network Support 199
Designing Network Applications 199
Working with an Application Server 199
Managing Lengthy Network Operations 200
Informing the User of Network Activity 201
Developing Network Applications 201
Enabling Network Testing on the Emulator 202
Testing Network Applications on Kindle Fire 202
Accessing Network Services 202
Planning Have You Read That? Network Support 202
Setting Network Permissions 203
Checking Network Status 203
Using HTTP Networking 203
Indicating Network Activity with Progress Bars 204
Displaying Indeterminate Progress 204
Displaying Determinate Progress 204
Displaying Progress Dialogs 204
Running Tasks Asynchronously 206
Using AsyncTask 206
Using Threads and Handlers 207
Downloading and Displaying Score Data 207
Extending AsyncTask for Score Downloads 207
Starting the Progress Indicator with onPreExecute() 208
Clearing the Progress Indicator with onPostExecute() 209
Handling Cancellation with onCancelled() 209
Handling Processing with doInBackground() 210
Handling Progress Updates with onProgressUpdate() 211
Starting the ScoreDownloaderTask 212
Downloading and Parsing Batches of Books 213
Extending AsyncTask for Book Downloads 213
Starting the Progress Dialog with onPreExecute() 214
Dismissing the Progress Dialog with onPostExecute() 214
Handling the Background Processing 215
Starting the BookListDownloaderTask 215
Determining What Data to Send to the Server 216
Keeping Player Data in Sync 216
Uploading Settings Data to a Remote Server 217
Working with Android Services 218
Implementing UploadTask 220
Uploading Player Data with the HTTP GET Method 220
Uploading Score Data to a Remote Server 223
Downloading Friends’ Score Data 224
Summary 224
Exercises 224
14 Exploring the Amazon Web Services SDK for Android 225
The 10,000-Foot View of AWS 225
Exploring the AWS Offerings 226
Using AWS Database and Storage Services 227
Using AWS Messaging and Notification Services 227
Using AWS Infrastructure and Administrative Services 228
Summary 228
Exercises 228
III: Publishing Your Kindle Fire Application
15 Managing Alternative and Localized Resources 233
Using the Alternative Resource Hierarchy 233
Understanding How Resources Are Resolved 234
Organizing Alternative Resources with Qualifiers 234
Using Alternative Resources Programmatically 236
Organizing Application Resources Efficiently 236
Customizing the Application Experience 237
Updating the Main Screen 237
Updating the Splash Screen 238
Updating the Game Screen 239
Updating the Other Screens 240
Internationalizing Android Applications 240
How Android Localization Works 241
How the Android Operating System Handles Locale 241
How Applications Handle Locales 241
How Kindle Fire Handles Locales 243
Android Internationalization Strategies 243
Forgoing Application Internationalization 244
Limiting Application Internationalization 245
Implementing Full Application Internationalization 245
Using Localization Utilities 246
Determining System Locale 246
Formatting Strings Like Dates and Times 246
Handling Currencies 247
Summary 247
Exercises 247
16 Testing Kindle Fire Applications 249
Testing Best Practices 249
Developing Coding Standards 250
Performing Regular Versioned Builds 250
Using a Defect Tracking System 251
Developing Good Test Plans 251
Maximizing Test Coverage 252
Testing on the Emulator 252
Testing on Target Devices 253
Performing Automated Testing 253
Summary 260
Exercises 260
17 Registering as an Amazon Application Developer 261
Understanding the Release Process 261
Preparing the Release Candidate Build 263
Preparing the Android Manifest File for Release 263
Protecting Your Application from Software Pirates 264
Readying Related Services for Release 265
Testing the Application Release Candidate 265
Signing Up as an Amazon App Developer 266
Packaging and Signing an Application 267
Digitally Signing Applications 267
Exporting and Signing the Package File 267
Testing the Signed Application Package 268
Installing the Signed Application Package 269
Verifying the Signed Application 269
Summary 270
Exercises 270
18 Publishing Applications on the Amazon Appstore 271
Selling on the Amazon Appstore 271
Signing Up for a Developer Account 271
Complying with the Developer License Agreement 272
Uploading an Application 272
Understanding Amazon Appstore Royalties 273
Using Other Developer Account Benefits 273
Generating Reports 274
Summary 274
Exercises 274
IV: Appendixes
A Configuring Your Android Development Environment 279
Configuring Your Development Environment 279
Development Machine Prerequisites 280
Installing the Java Development Kit 281
Installing the Eclipse IDE 281
Installing the Android SDK 281
Installing and Configuring the Android Plug-In for Eclipse (ADT) 282
Downloading Android SDK Components 282
Upgrading the Android SDK and Tools 284
Debugging with the Amazon Kindle Fire 284
Configuring Other Android Devices for Development Purposes 286
B Eclipse IDE Tips and Tricks 289
Organizing Your Eclipse Workspace 289
Writing Code in Java 293
C Supplementary Materials 299
Using the Source Code for This Book 299
Accessing the Android Developer Website 300
Accessing the Publisher`s Website 300
Accessing the Authors` Website 301
Contacting the Authors 303
Leveraging Online Android Resources 304
Index 305
Erscheint lt. Verlag | 9.8.2012 |
---|---|
Verlagsort | New Jersey |
Sprache | englisch |
Maße | 180 x 227 mm |
Gewicht | 550 g |
Themenwelt | Informatik ► Software Entwicklung ► Mobile- / App-Entwicklung |
Informatik ► Weitere Themen ► Smartphones / Tablets | |
Technik ► Nachrichtentechnik | |
ISBN-10 | 0-321-83397-X / 032183397X |
ISBN-13 | 978-0-321-83397-6 / 9780321833976 |
Zustand | Neuware |
Haben Sie eine Frage zum Produkt? |
aus dem Bereich