没有合适的资源?快使用搜索试试~ 我知道了~
首页Android初级入门:从书籍到市场发布全指南
Android初级入门:从书籍到市场发布全指南

《Android初级开发入门指南》是一本针对初学者编写的实用教程,由Donn Felker撰写,他作为一名独立软件开发顾问,专门指导读者如何在Android平台上进行应用开发。本书适合那些想要学习如何为热门智能手机,如Droid X、Galaxy S和MyTouch等设备创建应用程序的人。
首先,作者引导读者下载并安装Android Software Development Kit (SDK),这包括了必要的开发工具,如Eclipse集成开发环境。通过SDK,开发者可以学习到如何编写和调试Android应用程序,掌握Java编程语言在Android平台上的应用,这是构建安卓应用的基础。
书中特别强调了如何将应用程序提交至Android Market(现已被Google Play Store取代),这是一个重要的环节,因为这能让开发者将自己的作品分发给全球用户,并从中获得收益。此外,作者还贴心地提供了免费的Cheat Sheets,这些工具包含了检查清单、图表、常见指令以及其它有助于学习的资料,极大地简化了学习过程。
Dummies.com网站是这本书的重要资源支持,提供了一系列视频教程、插图文章以及详细的步骤指导,让学习者能够跟随逐步操作,逐步提升技能。不仅如此,每个月还有机会通过参与Dummies.com的抽奖活动,赢取有价值的奖品,增加了学习的乐趣。
如果你想持续获取关于数字摄影、微软Windows与Office、个人理财与投资、健康与福祉、计算机技术、iPods与手机、eBay、互联网、美食、家居与园艺等方面的资讯,Dummies.com也提供了丰富的新闻简报服务,让你的生活和技能得到全方位的提升。
《Android初级开发入门指南》是一本实用且全面的教材,无论是对于初次接触Android开发的新手,还是希望提升现有技能的开发者,都能从中获益匪浅。通过这本书,读者可以系统地学习如何利用Android技术打造简单易用的应用,实现数字化生活中的各种便利。

Android Application Development For Dummies
xiv
Chapter 2: Prepping Your Development Headquarters . . . . . . . . . . . . .25
Developing the Android Developer Inside You .........................................25
Assembling Your Toolkit ..............................................................................26
Android source code ...........................................................................26
Linux 2.6 kernel ....................................................................................27
Android framework..............................................................................27
Application framework ........................................................................28
Open Handset Alliance libraries ........................................................30
Java knowledge ....................................................................................31
Tuning Up Your Hardware ...........................................................................31
Operating system .................................................................................31
Computer hardware ............................................................................32
Installing and Con guring Your Support Tools .........................................32
Getting the Java Development Kit ...............................................................33
Downloading the JDK ..........................................................................33
Installing the JDK .................................................................................35
Acquiring the Android SDK ..........................................................................35
Downloading the Android SDK ...........................................................35
Following and setting your tools path ..............................................38
Getting the Total Eclipse ..............................................................................41
Choosing the right Eclipse version ....................................................41
Installing Eclipse ..................................................................................41
Con guring Eclipse ..............................................................................43
Getting Acquainted with the Android Development Tools ......................47
Navigating the Android SDK ...............................................................47
Targeting Android platforms ..............................................................48
Using SDK tools for everyday development .....................................49
Part II: Building and Publishing
Your First Android Application .................................... 53
Chapter 3: Your First Android Project. . . . . . . . . . . . . . . . . . . . . . . . . . . .55
Starting a New Project in Eclipse .................................................................55
Deconstructing Your Project .......................................................................61
Responding to error messages ..........................................................62
Understanding the Build Target and Min SDK Version settings ....63
Setting Up an Emulator .................................................................................65
Creating Launch Con gurations ..................................................................68
Creating a debug con guration ..........................................................68
Creating a run con guration ..............................................................68
Duplicating your launch con guration for quick setup ..................71
Running the Hello Android App ...................................................................72
Running the app in the emulator .......................................................72
Checking deployment status ..............................................................77
02_9780470770184-ftoc.indd xiv02_9780470770184-ftoc.indd xiv 11/2/10 8:46 AM11/2/10 8:46 AM

xv
Table of Contents
Understanding Project Structure ................................................................78
Navigating the app’s folders ...............................................................78
Viewing the application’s manifest le .............................................88
Viewing the default.properties le ....................................................90
Chapter 4: Designing the User Interface . . . . . . . . . . . . . . . . . . . . . . . . .93
Creating the Silent Mode Toggle Application ............................................94
Laying Out the Application ..........................................................................95
Using the XML layout le ....................................................................96
Using the Android SDK’s layout tools ...............................................98
Using the visual designer ....................................................................99
Developing the User Interface .................................................................... 102
Viewing XML layout attributes .........................................................102
Working with views ...........................................................................103
Adding an Image to Your Application .......................................................104
Placing an image on the screen........................................................105
Adding the image to the layout ........................................................106
Creating a Launcher Icon for the Application ..........................................108
Designing a custom launcher icon ...................................................109
Adding a custom launcher icon .......................................................110
Adding a Toggle Button Widget .................................................................111
Previewing the Application in the Visual Designer .................................113
Changing the orientation ..................................................................114
Changing the background color .......................................................114
Chapter 5: Coding Your Application . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
Understanding Activities ............................................................................117
Working with methods, stacks, and states .....................................118
Tracking an activity’s life cycle ........................................................119
Creating Your First Activity .......................................................................122
Starting with onCreate ......................................................................122
Handling the bundle ..........................................................................123
Telling Android to display the UI .....................................................123
Handling user input ...........................................................................124
Writing your rst event handler ......................................................125
Working with the Android Framework Classes .......................................128
Getting good service ..........................................................................128
Toggling silent mode with AudioManager ......................................129
Installing Your Application ......................................................................... 133
Returning to the emulator ................................................................133
Installing on a physical Android device ..........................................135
Reinstalling Your Application ....................................................................137
Understanding the state of the emulator ........................................137
Doing the reinstallation .....................................................................137
Uh-oh!: Responding to Errors .....................................................................138
Using the Dalvik Debug Monitor Server ..........................................138
Using the Eclipse debugger ..............................................................143
02_9780470770184-ftoc.indd xv02_9780470770184-ftoc.indd xv 11/2/10 8:46 AM11/2/10 8:46 AM

Android Application Development For Dummies
xvi
Thinking Beyond Your Application Boundaries ......................................151
Interacting with your application ....................................................151
Does it work?: Testing your application .........................................152
Chapter 6: Understanding Android Resources . . . . . . . . . . . . . . . . . . .155
Understanding Resources ..........................................................................155
Dimensions .........................................................................................156
Styles ...................................................................................................156
Themes ................................................................................................157
Values .................................................................................................. 157
Menus .................................................................................................. 157
Colors ..................................................................................................158
Working with Resources .............................................................................158
Moving strings into resources .........................................................158
Wrestling the image beast ................................................................160
Making your apps global with resources ........................................161
Chapter 7: Turning Your Application into a Home-Screen Widget. . . .163
Working with App Widgets in Android .....................................................164
Working with remote views ..............................................................165
Using AppWidgetProviders ..............................................................166
Working with Pending Intents ....................................................................167
Understanding the Android intent system .....................................167
Understanding intent data ................................................................168
Evaluating intents ..............................................................................170
Using pending intents ........................................................................170
Creating the Home-Screen Widget .............................................................172
Implementing the AppWidgetProvider ...........................................172
Communicating with the app widget ..............................................173
Building the app widget’s layout .....................................................175
Doing work inside an AppWidgetProvider .....................................176
Working with the app widget’s metadata .......................................181
Registering your new components with the manifest...................182
Placing Your Widget on the Home Screen ................................................184
Chapter 8: Publishing Your App to the Android Market . . . . . . . . . . .187
Creating a Distributable File ....................................................................... 187
Revisiting the manifest le................................................................188
Choosing your tools ..........................................................................189
Digitally signing your application ....................................................189
Creating the APK le ..........................................................................191
Creating an Android Market Account .......................................................194
Pricing Your Application ............................................................................200
Why to choose the paid model ........................................................200
Why to choose the free model .........................................................201
Getting Screen Shots for Your Application ..............................................201
Uploading Your Application to the Android Market ...............................203
Watching the Installs Soar ..........................................................................207
02_9780470770184-ftoc.indd xvi02_9780470770184-ftoc.indd xvi 11/2/10 8:46 AM11/2/10 8:46 AM

xvii
Table of Contents
Part III: Creating a Feature-Rich Application ............. 209
Chapter 9: Designing the Task Reminder Application . . . . . . . . . . . .211
Reviewing the Basic Requirements ...........................................................211
That’s alarming!: Scheduling a reminder script .............................212
Storing data ........................................................................................212
Distracting the user (nicely).............................................................213
Creating the Application’s Screens ...........................................................213
Starting the new project....................................................................214
Creating the task list ..........................................................................214
Creating and editing task activities .................................................216
Creating the adding/editing layout ..................................................217
Creating Your First List Activity ................................................................220
Getting stubby with fake data ..........................................................221
Handling user click events ................................................................222
Identifying Your Intent ................................................................................224
Starting new activities with intents .................................................224
Retrieving values from previous activities .....................................225
Creating a chooser .............................................................................226
Chapter 10: Going a la Carte with Your Menu. . . . . . . . . . . . . . . . . . . .231
Seeing What Makes a Menu Great .............................................................232
Creating Your First Menu ...........................................................................232
De ning the XML le..........................................................................232
Handling user actions ........................................................................234
Creating a reminder task...................................................................235
Completing the activity .....................................................................235
Creating a Context Menu ............................................................................236
Creating the menu XML le ..............................................................237
Loading the menu ..............................................................................237
Handling user selections ...................................................................238
Chapter 11: Handling User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241
Creating the User Input Interface ..............................................................241
Creating an EditText widget .............................................................241
Displaying an on-screen keyboard ..................................................243
Getting Choosy with Dates and Times ......................................................244
Creating picker buttons ....................................................................244
Wiring up the date picker .................................................................245
Wiring up the time picker .................................................................250
Creating Your First Alert Dialog Box .........................................................252
Seeing why you should work with dialog boxes ............................253
Choosing the right dialog box for a task .........................................254
Creating your own alert dialog box .................................................255
Validating Input ...........................................................................................257
Toasting the user ...............................................................................258
Using other validation techniques...................................................258
02_9780470770184-ftoc.indd xvii02_9780470770184-ftoc.indd xvii 11/2/10 8:46 AM11/2/10 8:46 AM

Android Application Development For Dummies
xviii
Chapter 12: Getting Persistent with Data Storage . . . . . . . . . . . . . . . .261
Finding Places to Put Data ..........................................................................261
Viewing your storage options ..........................................................262
Choosing a storage option ................................................................263
Asking the User for Permission .................................................................264
Seeing how permissions affect the user experience .....................264
Setting requested permissions in the AndroidManifest.xml le ..... 264
Creating Your Application’s SQLite Database .........................................266
Understanding how the SQLite database will work ......................266
Creating a Java le to hold the database code ..............................267
De ning the key elements .................................................................267
Visualizing the SQL table ..................................................................269
Creating the database table ..............................................................270
Closing the database .........................................................................271
Creating and Editing Tasks with SQLite ...................................................272
Inserting your rst task entry...........................................................272
Returning all the tasks with a cursor ..............................................281
Understanding the SimpleCursorAdapter ......................................283
Deleting a task ....................................................................................284
Updating a task...................................................................................284
Chapter 13: Reminding the User with AlarmManager. . . . . . . . . . . . .291
Seeing Why You Need AlarmManager ......................................................291
Waking Up a Process with AlarmManager ...............................................292
Creating the ReminderManager class .............................................293
Creating the OnAlarmReceiver class ...............................................295
Creating the WakeReminder-IntentService class ...........................296
Creating the ReminderService class ................................................298
Rebooting Devices .......................................................................................299
Creating a boot receiver ...................................................................300
Checking the boot receiver ..............................................................302
Chapter 14: Updating the Android Status Bar . . . . . . . . . . . . . . . . . . . .303
Deconstructing the Status Bar ...................................................................303
Viewing status bar icons ...................................................................303
Using status-bar tools to notify the user ........................................304
Using the Noti cation Manager .................................................................307
Creating your rst noti cation .........................................................307
Viewing the work ow ........................................................................309
Adding string resources ....................................................................310
Updating a Noti cation ...............................................................................310
Clearing a Noti cation ................................................................................311
Chapter 15: Working with Android’s Preference Framework . . . . . .313
Understanding Android’s Preference Framework ...................................314
Understanding the PreferenceActivity Class ...........................................314
Persisting preference values ............................................................315
Laying out preferences......................................................................316
02_9780470770184-ftoc.indd xviii02_9780470770184-ftoc.indd xviii 11/2/10 8:46 AM11/2/10 8:46 AM
剩余387页未读,继续阅读
2012-01-16 上传
2010-11-14 上传
2012-12-07 上传
2012-04-25 上传
2011-12-20 上传
2011-10-10 上传
2012-08-03 上传
2011-12-24 上传
2011-04-15 上传

qqq624345371
- 粉丝: 18
- 资源: 18
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

最新资源
- Material Design 示例:展示Android材料设计的应用
- 农产品供销服务系统设计与实现
- Java实现两个数字相加的基本代码示例
- Delphi代码生成器:模板引擎与数据库实体类
- 三菱PLC控制四台电机启动程序解析
- SSM+Vue智能停车场管理系统的实现与源码分析
- Java帮助系统代码实现与解析
- 开发台:自由职业者专用的MEAN堆栈客户端管理工具
- SSM+Vue房屋租赁系统开发实战(含源码与教程)
- Java实现最大公约数与最小公倍数算法
- 构建模块化AngularJS应用的四边形工具
- SSM+Vue抗疫医疗销售平台源码教程
- 掌握Spring Expression Language及其应用
- 20页可爱卡通手绘儿童旅游相册PPT模板
- JavaWebWidget框架:简化Web应用开发
- 深入探讨Spring Boot框架与其他组件的集成应用
安全验证
文档复制为VIP权益,开通VIP直接复制
