android開發(fā)計(jì)算器課程設(shè)計(jì)匯本_第1頁
android開發(fā)計(jì)算器課程設(shè)計(jì)匯本_第2頁
android開發(fā)計(jì)算器課程設(shè)計(jì)匯本_第3頁
已閱讀5頁,還剩37頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、An droid應(yīng)用程序開發(fā)實(shí)驗(yàn)報(bào)告學(xué) 號(hào):131006105學(xué)生:會(huì)會(huì)扌旨導(dǎo)教師:齊兵輝提交時(shí)間:第一章系統(tǒng)分析與設(shè)計(jì)31.1系統(tǒng)的可行性分析31.2系統(tǒng)的需求分析4第二章系統(tǒng)詳細(xì)設(shè)計(jì) 42.1 ACTIVITY的詳細(xì)設(shè)計(jì)42.2 XML文件的詳細(xì)設(shè)計(jì) 4第三章測試運(yùn)行及總結(jié)193.1界面截圖293.2運(yùn)行界面截圖303.3運(yùn)行結(jié)果截圖31目錄3.4總結(jié)35第一章系統(tǒng)分析與設(shè)計(jì)1.1系統(tǒng)的可行性分析可行性研究是為了弄清楚系統(tǒng)開發(fā)的工程是不是可以實(shí)現(xiàn)和值得進(jìn)展研究的過程,實(shí)際上是一次大大簡化系統(tǒng)分析和系統(tǒng)設(shè)計(jì)的過程,所以,進(jìn)展可執(zhí)行性的分析是非常必要的,也是很重要的,經(jīng)過最初的設(shè)計(jì)目標(biāo)和進(jìn)展的

2、實(shí)時(shí)調(diào)查 得出以下四點(diǎn)的可行性分析:1技術(shù)可行性:Eclipse + An droid ADT的技術(shù)已經(jīng)較為成熟,通過SUN公司現(xiàn)被ORCEL公司收購?fù)瞥龅目缙脚_(tái)、動(dòng)態(tài)的 JAVA語言進(jìn)展開發(fā)。2運(yùn)行可行性:該系統(tǒng)需要An droid虛擬機(jī)環(huán)境,Eclipse中安裝ADT,DDMS等Google An droid 相關(guān)插件。其運(yùn)行環(huán)境已經(jīng)相當(dāng)穩(wěn)定,它功能豐富, 包括了完備的 An droid 程序的編碼、調(diào)試、測試和發(fā)布功能,其中支持所有An droid 應(yīng)用開發(fā)相關(guān)技術(shù),包括 SQLite,Skia,3D制作,An droid XML, 能夠很好的發(fā)布An droid的應(yīng)用程序APK包。3法

3、律可行性:因?yàn)槭亲灾鏖_發(fā)設(shè)計(jì),所以不會(huì)構(gòu)成侵權(quán),在法律上是可行的通過以上的可行性分析,將采用Eclipse+Android ADT + DDMS 技術(shù),運(yùn)用JAVA語言進(jìn)展系統(tǒng)的開發(fā)。1.2系統(tǒng)的需求分析根據(jù)分析需求,這個(gè)系統(tǒng)必須實(shí)現(xiàn)以下的功能:(1) 實(shí)現(xiàn)簡單的數(shù)字計(jì)算功能。作為計(jì)算器,其核心就是加減乘除。(2) 能夠在手機(jī)里面以良好的界面。第二章系統(tǒng)詳細(xì)設(shè)計(jì)2.1 activity 的詳細(xì)設(shè)計(jì)package .example.cou nter;importan droid.os.Bu ndle;importan droid.app.Activity;importan droid.view.

4、Me nu;importan droid.view.View;importan droid.view.View. On ClickListe ner;importan droid.widget.Butt on;importan droid.widget.TextView;privateTextView textViewl=n ullprivateButtonbutt onzone=n ullprivateButtonbutt on1=null ;privateButtonbutt on2 =null ;privateButtonbutt on3 =null ;privateButtonbutt

5、 on4 =null ;privateButtonbutt on5 =null ;privateButtonbutt on6 =null ;privateButtonbutt on7 =null ;privateButtonbutt on8 =null ;privateButtonbutt on9 =null ;privateButtonbutt on add=null ;privateButtonbutt onred=null ;privateButtonbutt on div=null ;privateButtonbutt onmul=null ;privateButtonbutt onp

6、int=null ;privateButtonbutt on bai=null ;privateButtonbutt ongen=null ;privateButtonbutt on equal=n ullprivateStri ng7 Illi .x=;privateStri ngy=;privatedouble r1 =0;privatedouble r2 =0;private int i=0;Overrideprotectedvoidon Create(Bu ndle saved In sta nceState) super .onCreate(savedInstanceState);s

7、etContentView(R.layout.activity_main );textView1=(TextView)fi ndViewByld(R.id.textView1butt on1=(Butt on)fin dViewByld(R.id.butto n1 );butt on2=(Butt on)fin dViewByld(R.id.button2 );butt on3=(Butt on)fin dViewByld(R.id.button3 );butt on4=(Butt on)fin dViewById(R.id.button4 );butt on5=(Butt on)fin dV

8、iewById(R.id.button5 );butt on6=(Butt on)fin dViewById(R.id.button6 );butt on7=(Butt on)fin dViewById(R.id.button7 );butt on8=(Butt on)fin dViewById(R.id.button8 );butt on9=(Butt on)fin dViewById(R.id.button9 );butt on zo ne= (Butto n)fin dViewByld(R.id.buttonO )butt on add=(Butt on)fin dViewById(R.

9、id.butt on addbutt on red=(Butto n)fin dViewById(R.id.butt onredbutt onmul=(Butt on)fin dViewById(R.id.butt onmul););););butt on bai= (Butt on)fin dViewById(R.id.butt on bai );butt on gen= (Butt on)fin dViewById(R.id.butt ongen );butto nequal= (Butto n)fin dViewById(R.id.butt on equal );butt on pi n

10、t= (Butto n)fin dViewByld(R.id.butt onpoint );button1 .setOnClickListener(new OnClickListener() Overridepublicvoid on Click(View argO) / TODO Auto-generated method stubx= x+ "1"y= y+ "1"textView1 .setText( y););button2 .setOnClickListener(new OnClickListener() Overridepublicvoid

11、on Click(View arg0) / TODO Auto-generated method stub x= x+ "2"y= y+ "2"; textViewl .setText( y););button3 .setOnClickListener(new OnClickListener() Overridepublicvoidon Click(View argO) / TODO Auto-generated method stubx=x+ "3"y= y+ "3"textView1 .setText( y);

12、);button4 .setOnClickListener(new OnClickListener() Overridepublicvoidon Click(View arg0) / TODO Auto-generated method stubx= x+ "4"y= y+ "4"textView1 .setText( y););button5 .setOnClickListener(new OnClickListener() Overridepublicvoidon Click(View argO) / TODO Auto-generated meth

13、od stubx=x+ "5"y= y+ "5"textView1 .setText( y););button6 .setOnClickListener(new OnClickListener() Overridepublicvoidon Click(View arg0) / TODO Auto-generated method stubx= x+ "6"y= y+ "6"textView1 .setText( y););button7 .setOnClickListener( new OnClickListene

14、r() Overridepublicvoid on Click(View argO) / TODO Auto-generated method stubx= x+ "7"y= y+ "7"textView1 .setText( y););button8 .setOnClickListener(new OnClickListener() Overridepublicvoid on Click(View arg0) / TODO Auto-generated method stubx= x+ "8"y= y+ "8"t

15、extView1 .setText( y););button9 .setOnClickListener(new OnClickListener() Override publicvoid on Click(View argO) / TODO Auto-generated method stub x= x+ "9"y= y+ "9"textView1 .setText( y););butt onzone.set On ClickListe ner(newOverridepublicvoidon Click(View arg0) / TODO Auto-ge

16、nerated method stubx= x+ "0"y= y+ "0"textView1 .setText( y););butt onpint.set On ClickListe ner(newOn ClickListe ner() On ClickListe ner() Overridepublicvoid on Click(View argO) / TODO Auto-generated method stubif (x= "") y= y+ "."x=0+ "." +III!y=0+I

17、II!else x= x+I! I!textView1 .setText( y););butt on equal.set On ClickListe ner(new On ClickListe ner() Overridepublicvoid on Click(View arg0) / TODO Auto-generated method stubif (x != "")r2=Double. parseDouble (x);7 Illi .X-;switch (i)case 0: textViewl .setText(O+ "");break ;case

18、 1: textViewl .setText( r1 + r2)+ "");break ;case 2: textViewl .setText( r1 -r2 )+ ""); break ;case 3:textViewl .setText( r1 *r2 )+ ""); break ;case 4:textViewl.setText( r1/r2)+"");breakcase 5:textView1 .setText( r1 %r2)+ "");breakelse x=III!r1 =0;r2

19、 =0;i=0;x=III!y=III!);butt on add.set On ClickListe ner(new On ClickListe ner() Overridepublicvoidon Click(View argO) / TODO Auto-generated method stubif (x != "")r1 =Double. parseDouble (x);7 Illi .X-;y= y+ "+"i=1;else textViewl .setText(O+ ""););butt on red.set On Cli

20、ckListe ner(new On ClickListe ner() Overridepublicvoidon Click(View argO) / TODO Auto-generated method stubif (x != "")r1 =Double. parseDouble (x);7 Illi .x=;y= y+ "-"textView1 .setText( y);i=2;else );On ClickListe ner() butt on mul.set On ClickListe ner(newOverridepublicvoidon C

21、lick(View argO) / TODO Auto-generated method stubif (x != "")r1 =Double. parseDouble (x);7 Illi .X-;y= y+ "*"textViewl .setText( y);i=3;else textViewl .setText(0+ ""););Overridepublicvoidon Click(View argO) / TODO Auto-generated method stubif (x != "")r1 =Doub

22、le. parseDouble (x);7 Illi .X-;y= y+ "/"textViewl .setText( y);i=4;else textViewl .setText(0+ ""););butt on bai.set On ClickListe ner(new On ClickListe ner() Overridepublicvoid on Click(View argO) / TODO Auto-generated method stub if (x != "")r1 =Double. parseDouble (x)

23、;7 Illi .X=;y= y+"%"textView1 .setText( y);i=5;else textView1 .setText(0+ ""););On ClickListe ner() butt ongen.set On ClickListe ner(newOverridepublicvoidon Click(View argO) / TODO Auto-generated method stubif (x != "")y= "1/" + x;textView1 .setText( y);r1 =1/

24、(Double. parseDouble (x);x= r1 +""else textViewl .setText(O+ ""););Overridepublicboolea non CreateOpti on sMe nu(Me nu menu) /I nflate the menu; this adds items to the acti on bar if it is prese nt.getMenulnflater().inflate(R.menu.main , menu);returntrue ;2.2 xml文件的詳細(xì)設(shè)計(jì)< GridL

25、ayout xmlns:android= "schemas.android./apk/res/android"xmln s:tools = "schemas.a ndroid./tools"an droid:layout_height="wrap_c ontent"an droid:orie ntatio n="horizo ntal"an droid:layout_gravity = "cen ter"an droid:colum nCou nt= "5"an droid:

26、rowCou nt= "5"tools:co ntext = ".MainActivity" >< TextViewan droid:id = "+id/textView1"an droid:layout_width = "230dp"an droid:layout_height = "30dp"an droid:layout_colum n = "0"an droid:layout_colum nSpa n = "5"an droid:lay

27、out_row = "0"an droid:gravity = "right"an droid:text = "stri ng/result"android:textSize = "25sp" />< Butt onstyle = "?a ndroid:attr/butto nStyleSmall"an droid:layout_colum n = "0"an droid:layout_gravity = "left|top"an droid:

28、layout_row = "1"an droid:text = "stri ng/seleve n"/>< Butt onan droid:id = "+id/butto n8"style = "?a ndroid:attr/butto nStyleSmall"an droid:layout_colum n ="1"an droid:layout_gravity = "left|top"an droid:layout_row = "1"an d

29、roid:text = "stri ng/eight" />< Butt onan droid:id ="+id/butto n9"style = "?a ndroid:attr/butto nStyleSmall"an droid:layout_colum n = "2"an droid:layout_gravity = "left|top"an droid:layout_row = "1"< Button style = "?a ndroid:

30、attr/butto nStyleSmall"an droid:layout_colum n = "3"an droid:layout_gravity = "left|top"an droid:layout_row = "1"an droid:text = "stri ng/div" />< Butt onan droid:id= "+id/butt on bai"style = "?a ndroid:attr/butto nStyleSmall"an

31、droid:layout_colum n = "4"an droid:layout_gravity = "left|top"an droid:layout_row = "1"an droid:text = "stri ng/bai" />< Butt onan droid:id = "+id/butto n4"style = "?a ndroid:attr/butto nStyleSmall"an droid:layout_gravity = "left

32、|top"an droid:layout_row = "2"an droid:text = "stri ng/four" />< Butt onan droid:id ="+id/butto n5"style = "?a ndroid:attr/butto nStyleSmall"an droid:layout_colum n ="1"an droid:layout_gravity = "left|top"an droid:layout_row = &q

33、uot;2"an droid:text = "stri ng/five" />< Butt onan droid:id = "+id/butto n6"style = "?a ndroid:attr/butto nStyleSmall"an droid:layout_colum n = "2"an droid:layout_gravity = "left|top"an droid:layout_row = "2"an droid:text = "

34、;stri ng/six" />< Butt onan droid:id= "+id/butt onm ul"an droid:layout_colum n an droid:layout_gravity = "left|top"an droid:layout_row = "2"an droid:text = "stri ng/mul"/>< Butt onan droid:id="+id/butt ongen"style = "?a ndroid:a

35、ttr/butto nStyleSmall"an droid:layout_colum n = "4"an droid:layout_gravity = "left|top"an droid:layout_row = "2"an droid:text = "stri ng/ge n"/>< Butt onan droid:id = "+id/butto n1"style = "?a ndroid:attr/butto nStyleSmall"an dro

36、id:layout_colum n = "0"an droid:layout_gravity = "left|top"an droid:text = "stri ng/one" />< Butt onan droid:id ="+id/butto n2"style = "?a ndroid:attr/butto nStyleSmall"an droid:layout_colum n="1"an droid:layout_gravity = "left|t

37、op"an droid:layout_row = "3"an droid:text= "stri ng/two"/>< Butt onan droid:id = "+id/butto n3"style = "?a ndroid:attr/butto nStyleSmall"an droid:layout_colum n= "2"an droid:layout_gravity = "left|top"an droid:layout_row = "

38、3"an droid:text= "stri ng/three"/>< Butt onan droid:id= "+id/butt on red"an droid:layout_colum n an droid:layout_gravity = "left|top"an droid:layout_row = "3"an droid:text = "stri ng/red"/>< Butt onan droid:id="+id/butt on equal"style = "?a ndroid:attr/butto nStyleSmall"an droid:layout_width = "50dp"an droid:layout_colum n= "4"an droid:layout_gravity = "fill_vertical&quo

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論