Android
Android
Android
Android :程序员指南
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
1
1
1
1
版权 © 2008 McGraw-Hill 公司
Android
Android
Android
Android :程序员指南
:程序员指南
:程序员指南
:程序员指南
Android
Android
Android
Android :程序员指南
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
2
2
2
2
版权 © 2008 McGraw-Hill 公司
程序员指南
原著:
J.F. DiMarzio
翻译: 张劲锋
zyf19870302@126.com
仅供学习使用
版权归属原著作者
Android
Android
Android
Android :程序员指南
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
3
3
3
3
版权 © 2008 McGraw-Hill 公司
New York Chicago San Francisco
Lisbon London Madrid Mexico City
Milan New Delhi San Juan
Seoul Singapore Sydney Toronto
版权
©
2008 McGraw-Hill 公司 . 保留所有权 . U.S 出品 . 除被 U.S 1976 版权法令许可之外, 此
出版物的任何部分被禁止用任何形式或者电子书店以及复印组织, 没有被原著授予发行权 的
出版社以任何形式复制、散布、发行。
0-07-129989-4
本电子书的资料也标注有 0-07-129989-4 的版本标题 .
所有商标归它们各自的所有者。而不是在任何交易发生时放一个交易名称的商标符号 , 我们
只是以编辑形式使用了名称,为了商标所有者的利益,没有对商标的侵害意图。在本书出 现
该称号的地方,它们已经被印刷成首标注。
McGraw-Hill 电子书能以特殊数量的折扣作为奖品和增进促销或者公司培训项目来获得、 使
用。要获得更多信息,请联系 George Hoare, Special Sales, 通过 george_hoare@mcgraw-
hill.Com 或者( 212 ) 904-4069.
TERMS OF USE
This is a copyrighted work and The McGraw-Hill Companies, Inc. ( “ McGraw-Hill ” ) and its
licensors reserve all rights in and to the work. Use of this work is subject to these terms.
Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one
copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify,
create derivative works based upon, transmit, distribute , disseminate, sell, publish or
sublicense the work or any part of it without McGraw-Hill ’ s prior consent. You may use the
work for your own noncommercial and personal use; any other use of the work is strictly
prohibited. Your right to use the work may be terminated if you fail to comply with these
terms.
THE WORK IS PROVIDED “ AS IS.
”
McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTI ES
AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE
WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR
OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in
Android
Android
Android
Android :程序员指南
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
4
4
4
4
版权 © 2008 McGraw-Hill 公司
the work will meet your requirements or that its operation will be uninterrupted or error
free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any
inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting
therefrom. McGraw-Hill has no responsibility for the content of any information accessed
through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable
for any indirect, incidental, special, punitive, consequential or similar damages that
result from the use of or inability to use the work, even if any of them has been advised of
the possibility of such damages. This limitation of liability shall apply to any claim or
cause whatsoever whether such claim or cause arises in contract, tort or otherwise.
DOI: 10.1036/0071599886
本书贡献于
Suz annah, Christian, and Sophia
关于作者:
关于作者:
关于作者:
关于作者:
J.F.DiMarz io
J.F.DiMarz io
J.F.DiMarz io
J.F.DiMarz io 是一个在网络和程序开发领域拥有超过
1 5
年经验的程序开发员并且是 7 本关于计算机科学书籍的
作者。他已经成为 IT 界顾问和发展的领导人物。他住在
Central Florida.
关于技术编辑:
关于技术编辑:
关于技术编辑:
关于技术编辑:
Gilbert
Gilbert
Gilbert
Gilbert L.Polo
L.Polo
L.Polo
L.Polo 是一个在电信,财政,最近最多是教育
机构工作上拥有超过 20 年经验的程序开发员。他已经用
多种语言(包括 C,C++,Java 和 C# )项目编程。
Android
Android
Android
Android :程序员指南
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
5
5
5
5
版权 © 2008 McGraw-Hill 公司
目录浏览
目录浏览
目录浏览
目录浏览
1.
1.
1.
1.
什么是
什么是
什么是
什么是 Android
Android
Android
Android ?
?
?
? …………………………………………………
…………………………………………………
…………………………………………………
…………………………………………………
1
1
1
1
2.
2.
2.
2. 下载和安装
下载和安装
下载和安装
下载和安装 Eclipse
Eclipse
Eclipse
Eclipse ………………………………………………
………………………………………………
………………………………………………
………………………………………………
9
9
9
9
3.
3.
3.
3.
下载和安装
下载和安装
下载和安装
下载和安装 Android
Android
Android
Android SDK
SDK
SDK
SDK …………………………………………
…………………………………………
…………………………………………
………………………………………… 21
21
21
21
4.
4.
4.
4. 浏览
浏览
浏览
浏览 Android
Android
Android
Android SDK
SDK
SDK
SDK …………………………………………………
…………………………………………………
…………………………………………………
………………………………………………… 35
35
35
35
5.
5.
5.
5. 应用程序:
应用程序:
应用程序:
应用程序: Hello
Hello
Hello
Hello World
World
World
World !
!
!
! ………………………………………
………………………………………
………………………………………
……………………………………… 53
53
53
53
6.
6.
6.
6.
使用命令行工具和
使用命令行工具和
使用命令行工具和
使用命令行工具和 Android
Android
Android
Android 模拟器
模拟器
模拟器
模拟器 ……………………………
……………………………
……………………………
…………………………… 83
83
83
83
7.
7.
7.
7. 使用
使用
使用
使用 Intents
Intents
Intents
Intents 和
和
和
和 Phone
Phone
Phone
Phone Dialer
Dialer
Dialer
Dialer …………………………………
…………………………………
…………………………………
………………………………… 117
117
117
117
8.
8.
8.
8.
Lists
Lists
Lists
Lists ,
,
,
, Menus
Menus
Menus
Menus 和其他
和其他
和其他
和其他 View
View
View
View ………………………………………
………………………………………
………………………………………
……………………………………… 149
149
149
149
9.
9.
9.
9. 使用
使用
使用
使用 Cell
Cell
Cell
Cell Phone
Phone
Phone
Phone 的
的
的
的 GPS
GPS
GPS
GPS 功能
功能
功能
功能 ……………………………………
……………………………………
……………………………………
…………………………………… 203
203
203
203
10.
10.
10.
10. 和
和
和
和 GTalk
GTalk
GTalk
GTalk 一起使用
一起使用
一起使用
一起使用 Google
Google
Google
Google API
API
API
API …………………………………
…………………………………
…………………………………
………………………………… 23
23
23
23
9
9
9
9
11.
11.
11.
11.
应用程序:
应用程序:
应用程序:
应用程序: Find
Find
Find
Find
a
a
a
a
Friend
Friend
Friend
Friend ……………………………………
……………………………………
……………………………………
…………………………………… 257
257
257
257
12.
12.
12.
12. Android
Android
Android
Android SDK
SDK
SDK
SDK 工具参考
工具参考
工具参考
工具参考 ………………………………………
………………………………………
………………………………………
……………………………………… 307
307
307
307
索引
索引
索引
索引 …………………………………………………………………
…………………………………………………………………
…………………………………………………………………
………………………………………………………………… 313
313
313
313