学习Andriod------A Programmer‘s Guide
A Programmer‘s Guide
作者:Jerome DiMarzio
About author
JD 是一个有着15年开发经验的程序工程师。他主要从事于网络和项目开发中,本作者还有7本计算机技术书。也是算是个多产的人了。嘿嘿。他现在住在Central Florida(中佛罗里达)
下面就开始我们的Andriod之旅
What is Andriod?
(什么是Andriod那?)
Andriod一词的英文本义指机器人,它是Google公司2007年11宣布的基于Linux平台的开源手机操作系统,该平台由操作系统,中间件,用户界面和应用软件组成
Andriod的重要发展:
1.开放手机联盟成立
Open Handset Alliance
2.发布第一版Andriod SDK
3.Andriod 开发者竞赛
4.Anriod Market上线
5.T-Mobile G1 上市
6.Andriod1.0 SDK release1版本发布
7.Andriod被宣布开放源代码
8.Andriod 1.5,1.6,2.0,2.1,2.2,2.3,2.4,3.0发布
今年要发布3.1嘿嘿
工具:
这里就不介绍了,网上有的很多文章,还有我把书上的问答给大家翻译一下基本就没什么问题了:
Q: Eclipse is used to develop applications in Java, but can Android run applications
written in any other languages?
eclipse是用java开发应用程序的,那么Andriod能不能在其他语言中运行应用程序么?
A: As of the writing of this book, there were no other SDKs or emulators available to allow
Android development in any language other than Java.
本书出版今天为止,还没有其他SDKs或者可用的模拟器允许Andriod的项目运行,除了java
Q: Can you use Eclipse (and the Android SDK) with a version of the JRE other than
version 5?
你能用java 5版本么?
A: Technically you can use Eclipse with versions 5 and newer. However, the latest version
of Eclipse was only tested on the Java 5 JRE.
科学的说,你可以用,但最近的版本,测试的时候用的仅仅是java 5版本
Android Plugin.
地址:https://dl-ssl.google.com/android/eclipse/. Click OK.
Q: Is the Android SDK available for any languages other than Java?
Andriod SDK 能运行在其他语言上吗,除了java
A: No. Android applications can be developed only in Java.
不,Andriod 项目只能运行在java平台上
Q: Will there be updates to the Android SDK?
Andriod 能更新么?
A: Yes! Even during the writing of this book, an SDK update was released that addresses
many issues within the platform. I suggest checking the development page often for the
latest updates.
可以的。SDK的更新在网站上。我建议你更新最近版本
Q: If an update is released, how do I upgrade my SDK?
Upgrading the SDK can be very tricky. When a new SDK is released, chances are a
new plugin is also released. During the writing of this book, both a new SDK and a new
plugin were released. I attempted to use the “provided” upgrade tools to change
versions. However, this proved fruitless and left me with two conflicting versions,
neither of which worked correctly. I eventually had to uninstall both versions and
reinstall only the latest version. The newest SDK then worked correctly. I suggest that
anyone faced with the possibility of upgrading from one version of an SDK/plugin
combo to another use this same process: simply uninstall the older version, and install
the newer one, rather than upgrading.
上面的太多了。这里就大概说明下重点,他的建议在后面,先卸载旧版本,在安装新版本
其实还有更好的办法
上面没有QA中没有说明,这里说明一下:
From the command-line you can also directly trigger an update by
executing:
tools\android.bat update sdk
这个是在Andriod SDK中找到的,很简单 嘿嘿
找到tools文件夹下的 andriod.bat
然后运行
出现下面图片就ok了
点一下Update All
全部update
获得下面的东东,然后安装就ok了
Andriod SDK 和 ADT Ecplipse Plugin
下面介绍一下Andriod的四大天王
1.activity
2.intend
3.service
4.contentProvider
在介绍上面的天王级人物之前,我先介绍一下 怎么查看android的版本
大家可以在cmd中输入android list targets
就会出现下面的
Type: Platform
API level: 4
Revision: 3
Skins: WVGA800, QVGA, WVGA854, HVGA (default)
id: 3 or "android-7"
Name: Android 2.1-update1
Type: Platform
API level: 7
Revision: 2
Skins: WQVGA432, WVGA800, HVGA (default), WVGA854, QVGA, WQVGA400
id: 4 or "android-8"
Name: Android 2.2
Type: Platform
API level: 8
Revision: 2
Skins: HVGA (default), WQVGA400, WQVGA432, WVGA854, QVGA, WVGA800
id: 5 or "android-9"
Name: Android 2.3
Type: Platform
API level: 9
Revision: 1
Skins: HVGA (default), WVGA800, WQVGA432, QVGA, WVGA854, WQVGA400
id: 6 or "android-10"
Name: Android 2.3.3
Type: Platform
API level: 10
Revision: 1
Skins: WQVGA400, QVGA, WVGA800, HVGA (default), WQVGA432, WVGA854
嘿嘿大家可以看到 我有的版本到了2.3.3 现在有3.0的我这个更新只能到这个版本,大家可以先下载在更新,这样会有的
也可以独立的创建一个AVD
输入android create avd --name 2.2 --target 4