诚 信 声 明
我声明,所呈交的
毕业论文是本人在老师指导下进行的研究
工作及取得的研究成果。据我查证,除了文中特别加以标注和致谢的地方外,论文中不包含其他人已经发表或撰写过的研究成果,也不包含为获得其他教育机构的学位或证书而使用过的材料。我承诺,论文中的所有内容均真实、可信。
毕业论文作者签名: 签名日期: 年 月 日
Android平台天气预报widget的
设计与实现
摘 要
本文对基于Android平台的widget开发技术进行了分析和研究。先简要介绍了Android开发必备基础知识,再切入
软件的具体实现过程。
软件的实现是利用
网络接口和Google API获取网络
xml文件,然后通过xml文件解析取得城市天气预报信息。最终使用widget制作方法,利用RemoteViews等技术完成桌面部件。
关键词: Android;桌面小部件;天气预报
the design and implementation of weather forecasting widget on Android platform
ABSTRACT
This paper analyses and researches the development technique on the Android platform.It first introduce the basic knowledge that is necessary for Android development.And then it introduce the concrete implementation of the software.
The software uses network interface and Google API to get xml document.Then it parse the document to get the weather information of the city.Finally I use technique such as RemotViews to implement the widget.
Key
words: Android; widget; weather forecast
目 录
第1章 绪论 1
1.1 项目背景 1
1.2 研究现状 1
1.3 论文组织 2
第2章 ANDROID开发环境 3
2.1 ANDROID开发环境搭建流程 3
2.1.1 安装Eclipse ADT Plugin插件 3
2.1.2 安装Android SDK 4
2.1.3 更新Adroid SDK 5
2.1.4 配置Android模拟器 6
2.2 开发工具ECLIPSE介绍 7
第3章 ANDROID程序设计基础 9
3.1
系统结构 9
3.1.1 应用程序 9
3.1.2 应用程序框架 10
3.1.3 库和运行环境 11
3.2 ANDROID应用程序组成 11
3.2.1 Avtivity介绍 11
3.2.2 Broadcast Intent Receiver介绍 12
3.2.3 Service介绍 13
3.2.4 Content Provider介绍 13
3.2.5 Intent介绍 14
3.3 ANDROID应用程序工程文件 16
第4章 天气预报WIDGET的设计 18
4.1 网络功能实现 18
4.1.1 标准
Java接口 18
4.1.2 Apache接口 19
4.1.3 使用Java接口连接网络 22
4.2 XML解析的实现 22
4.3 制作WIDGET应用程序 26
4.3.1 源文件组织 28
4.3.2 类之间的协作 28
4.3.3 CurrentWeather类的实现 29
4.3.4 edit类的实现 30
4.3.5 WeatherHandle类的实现 30
第5章 相关实现技术与体会 32
5.1 添加WIDGET 32
5.2 REMOTEVIEWS的局限 33
5.3 在WIDGET中显示图片 34
5.4 在ANDROIDMANIFEST.XML中进行权限声明 34
5.5 为WIDGET中的按钮设置ONCLICK事件 35
5.6 利用BUNDLE实现消息的传递 36
5.7 在APPWIDGETPROVIDER类中获取INTENT的附加信息 36
5.8 软件使用 37
结论 40
致谢 41
参考文献 42
第1章 绪论
1.1 项目背景
2009年1月7日,工业和信息化部为中国移动、中国电信和中国联通发放3张第三代移动
通信牌照,此举标志着我国正式进入3G时代。中国3G正式商用和规模建网,决定了中国基于Android的应用程序开发将会处于一个蓬勃发展时期
Android是Google于07年11月5日宣布的基于Linux平台开源手机操作系统名称,号称是首个为移动终端打造的真正开放和完整的移动软件。 它包括操作系统、用户界面和应用程序 -- 移动电话工作所