Android课程设计.docx

上传人:b****6 文档编号:8246077 上传时间:2023-01-30 格式:DOCX 页数:32 大小:63.62KB
下载 相关 举报
Android课程设计.docx_第1页
第1页 / 共32页
Android课程设计.docx_第2页
第2页 / 共32页
Android课程设计.docx_第3页
第3页 / 共32页
Android课程设计.docx_第4页
第4页 / 共32页
Android课程设计.docx_第5页
第5页 / 共32页
点击查看更多>>
下载资源
资源描述

Android课程设计.docx

《Android课程设计.docx》由会员分享,可在线阅读,更多相关《Android课程设计.docx(32页珍藏版)》请在冰豆网上搜索。

Android课程设计.docx

Android课程设计

课程设计

题目计算器

姓名戴雄坤

学号

系部理工系

年级专业12级计算机

指导教师李津

2015年6月24日

 

中南林业科技大学涉外学院本科课程设计诚信声明

本人郑重声明:

所呈交的课程设计,就是本人在指导老师的指导下,独立进行研究工作所取得的成果,成果不存在知识产权争议,除设计中已经注明引用的内容外,本设计不含任何其她个人或集体已经发表或撰写过的作品成果。

对本设计的研究做出重要贡献的个人与集体均已在文中以明确方式标明。

本人完全意识到本声明的法律结果由本人承担。

 

课程设计作者签名:

二○一五年6月24日

 

摘要

Android就是当今最重要的手机开发平台之一,它就是建立在Java基础之上的,能够迅速建立手机软件的解决方案。

Android的功能十分强大,成为当今软件行业的一股新兴力量。

Android基于Linux平台,由操作系统、中间件、用户界面与应用软件组成,具有以下5个特点:

开放性、应用程序无界限、应用程序就是在平等条件下创建的,应用程序可以轻松的嵌入网络、应用程序可以并行运行。

而简单计算器又就是手机上必备的小程序,所以此次创新实践很有意义。

并且具有很强的使用性。

 

关键词:

AndroidJava基础计算器

 

1、引言---------------------------------------------------------5

§1、1Android开发背景 -------------------------------------------5

§1、2Android开发环境--------------------------------------6

2、Android应用程序开发理论与方法------------------6

§2、1Activity的相关知识 ----------------------------------6

§2、2Intent的相关知识 ---------------------------------7

3、“计算器”应用程序的设计与实现----------------7

§3、1  拟解决的问题及目标--------------------------------8

§3、2  总体设计-----------------------------------------------8

§3、3  详细设计与编码实现--------------------------------9

4、总结--------------------------------------------------------26

5、参考文献--------------------------------------------------27

 

1、引言

§1、1Android开发背景

1、智能手机的市场 

(1)功能多样化的智能手机挑战全球PC出货量 

移动互联网时代的来临,直接促进了搭载智能操作系统、具有强大扩展性的智能手机、平板电脑等移动终端产业的蓬勃发展。

来自美国最大的风险投资机构KPCB的数据显示,全球智能手机出货量正在以远高于台式电脑、笔记本电脑出货量的速度快速增长,该机构预计2011年全球智能手机出货量将达到4、13亿,超过台式电脑与笔记本电脑出货量的总与。

 

(2)智能手机的用户使用数量正在高速增长。

据市场调研机构Gartner信息,2011年全球智能手机的总出货量将会达到4、68亿部,相比2010年实现了57、7%的增长,而谷歌Android操作系统将会在今年之内成为全球最大的智能手机操作系统。

另外,全球市场调研机构IDC预计未来5年中国手机市场上,智能手机替代传统功能手机的趋势将日益明显,未来5年中国智能手机市场复合增长率将达到34、1%,人们对IT设备智能化的向往就是这一增长率能够实现的主要因素,并且与其她国家相比,中国智能手机市场的发展空间更加广阔。

 

(3)操作系统格局预测:

Android有望成为智能手机市场主导力量 

搭载Android操作系统的智能手机目前已经成为市场上最炙手可热的智能产品。

来自美国市场研究机构Gartner的数据显示,Android操作系统所占的市场份额从2008年的0、5%急剧增长到2011年的15、94%。

开放的源代码与零成本已经让Android在全世界范围内受到青睐并迅速获得了主要手机厂商与数百万软件开发者的支持,Gartner预计,未来Android系统的市场份额有望超过其她操作系统,从而成为全球第一大智能手机操作系统。

 2、安卓手机介绍 

安卓手机指的就是用Android操作系统的手机。

安卓(Android)就是基于Linux内核的操作系统,就是Google公司在2007年11月5日公布的手机操作系统。

 同样都就是手机上面用的智能系统,安卓的系统就是新生系统,界面更为华丽,开源性更强,当然因为就是新生系统,所以在第三方软件方面暂时还不太多。

因此,安卓应用程序的需求还就是很迫切的。

 

3、软件人才需求 

据业内统计,目前国内的Android研发人才缺口至少30万。

由于目前Android技术较新,无论就是相关书籍、培训还就是大学教育,都处于初级阶段,因此Android人才短期将供不应求。

从长期来瞧,随着各种移动应用与手机游戏等内容需求日益增加,也将激励大中小型手机应用开发商加大对Android应用的开发力度,因此Android人才的就业前景也非常广泛。

 

综上所述,在这样的背景下,安卓有很强的生命力。

同时,作为一个新生的系统,其应用程序目前并不多,安卓应用程序的需求还就是很迫切的,安卓研发人才的缺口还很大。

这些都促进了我们学习开发安卓应用程序。

§1、2开发环境

安卓应用程序开发环境如下:

 

1.JDK 7、0 or JDK 8、0 (JRE alone is not sufficient) 

2.Eclipse 

3.Android SDK  

4.ADT-23、0、6

5.Eclipse安装ADT 插件

2、安卓应用程序开发理论与方法

1、Activity的相关知识 

简单理解Activity 代表一个用户所能瞧到的屏幕,Activity 主要就是处理一个应用的整体性工作。

Activity就是最基本的Android 应用程序组件,应用程序中,一个活动通常就就是一个单独的屏幕。

每一个活动都被实现为一个独立的类,并且从活动基类中继承而来,活动类将会显示由视图控件组成的用户接口,并对事件做出响应。

大多数的应用就是由多个屏幕显示组成,因而要用到多个Activity。

 

(1)Activity的相关方法及相关函数:

 A、void onCreate(Bundle)  

首次启动时调用,接受参数:

Null or  savedInstanceState(保存的以前某些状态信息) 

B、void onStart()  

说明了将要显示给用户的活动 

 C、void onRestart()  

将处于停止状态的活动重新显示给用户

 D、void onResume()  

用户可以开始与活动进行交互时调用。

如动画播放与音乐播放。

 E、void onPause()  

活动将要进入后台运行时调用。

(此时前台启动了另一个活动)

 F、void onStop()  

不需要某个活动了,就调用 G、void onDestroy() 销毁活动 

(2)多个Activity之间的跳转:

 

     通过Intent类实现屏幕之间的跳转(包括没有参数关系与需要传递参数两种情况)。

 

(3)两个Activity之间进行数据交换:

      startActivity() 只有Intent一个参数。

 

public void startSubActivity(Intent intent, int requestCode)  (requestCode:

用来标识某一个调用,一般定义一个常量。

) 

传过去:

函数原型为:

publicIntentsetData(ContentURIdata)然后,参数带到新的Activity后,同样用Activity,getIntent()函数可得到当前过来的Intent对象,然后用getData()就去到参数了。

传回来:

函数原型为:

publicfinalvoidsetRsult(intresultCode,Stringdata)

  

2、Intent的相关知识 

 Intent 就是描述应用想要做什么。

Android 使用了Intent 这个特殊类,实现在屏幕与屏幕之间移动。

Intent 数据结构两个最重要的部分就是动作与动作对应的数据。

Intent类绑定一次操作,它负责携带这次操作所需要的数据以及操作的类型等。

 

3、Layout 

 用于用户界面设计。

包含AbsoluteLayout, FrameLayout,GridView, LinearLayout, ListLayout, RadioGroup, TableLayout等等。

 

在本程序中用到的有:

 

(1) 线性布局LinearLayout 

垂直:

android:

orientation="vertical“ 水平:

android:

orientation="horizontal" 

(2) 相对布局RelativeLayout 

让子元素指定它们相对于其她元素的位置(通过ID 来指定)或相对于父布局对象。

在RelativeLayout布局里的控件包含丰富的排列属性:

             

 Layout above:

控件在指定控件的上方 

Layout below:

控件在指定控件的下方

 Layout to left of„„

3、“计算器”应用程序的设计与实现

§3、1  拟解决的问题及目标

本计算器程序要解决日常生活中常见的基本数据计算问题,程序要实现的目标有如下几个:

(1) 要实现基本的加、减、乘、除四则运算。

 

(2) 可以实现在前一步计算结果上继续作加、减、乘、除,即连加、减、乘、除。

 

(3) 有清空功能,即清除所有数据,重新开始计算。

(4)还可以进行一些特别的运算,开方、乘方运算。

§3、2  总体设计 

1、系统结构图

计算器

基本加减其它运算

乘除运算

乘方

根号

2、功能的操作流程 

首先用户根据自己的实际需要选择计算的类型,然后进入不同的计算类型,再进行要执行的运算,输入数据,选择运算符号,即可得到结果。

 

§3、3  详细设计与编码实现

1.Android程序图标如下图所示

 

2.计算器界面如下图所示:

布局Main、xml代码如下:

xmlversion="1、0"encoding="utf-8"?

>

xmlns:

android=""

android:

layout_width="fill_parent"

android:

layout_height="fill_parent"

android:

orientation="vertical"

android:

layout_gravity="center_vertical"

android:

id="@+id/zhengfu"

android:

background="@drawable/default_bg">

android:

text="TextView"

android:

id="@+id/textView1"

android:

textSize="25sp"

android:

textColor="#000000"

android:

layout_gravity="center"

android:

gravity="left"

android:

cursorVisible="false"

android:

editable="false"

android:

layout_height="wrap_content"

android:

layout_width="fill_parent"

android:

layout_marginLeft="4dip"

android:

layout_marginRight="4dip"

android:

layout_marginTop="4dip"

android:

layout_weight="1、5">

android:

id="@+id/tablelayout"

android:

layout_width="fill_parent"

android:

layout_height="wrap_content"

android:

layout_margin="4dip"

android:

layout_weight="10">

android:

id="@+id/linearlayout02"

android:

layout_width="fill_parent"

android:

layout_height="wrap_content"

android:

layout_weight="1">

android:

layout_width="50dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

id="@+id/button08"

android:

text="@string/shan"

>

android:

layout_width="50dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

id="@+id/button07"

android:

text="@string/shanchu"

>

android:

id="@+id/row0"

android:

layout_width="fill_parent"

android:

layout_height="fill_parent"

android:

layout_weight="1">

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/one"

android:

id="@+id/button1"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/two"

android:

id="@+id/button2"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/three"

android:

id="@+id/button3"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/jia"

android:

id="@+id/button01"

>

android:

id="@+id/row1"

android:

layout_width="fill_parent"

android:

layout_height="fill_parent"

android:

layout_weight="1">

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/four"

android:

id="@+id/button4"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/five"

android:

id="@+id/button5"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/six"

android:

id="@+id/button6"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/jian"

android:

id="@+id/button02"

>

android:

id="@+id/row2"

android:

layout_width="fill_parent"

android:

layout_height="fill_parent"

android:

layout_weight="1">

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/seven"

android:

id="@+id/button7"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/eight"

android:

id="@+id/button8"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/nine"

android:

id="@+id/button9"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

text="@string/cheng"

android:

id="@+id/button03"

>

android:

id="@+id/row3"

android:

layout_width="fill_parent"

android:

layout_height="fill_parent"

android:

layout_weight="1">

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout_weight="1"

android:

textSize="25sp"

android:

id="@+id/button06"

android:

text="@string/dianhao"

>

android:

layout_width="40dip"

android:

layout_height="fill_parent"

android:

layout

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 农林牧渔 > 水产渔业

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1