



版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、android實(shí)驗(yàn)一實(shí)驗(yàn)報(bào)告 a dr d 實(shí)驗(yàn)報(bào)告 一 姓名: : 丁軍峰 班級:信科2 2 3 3 學(xué)號: : 08 34 一、 實(shí)驗(yàn) 內(nèi)容 編寫一個ndrid 應(yīng)用程序,實(shí)現(xiàn)對自己物品得管理,功能包括添加、刪除與查詢等 二、 實(shí)驗(yàn) 目得 了解ndrd 開發(fā)流程,掌握qlite 數(shù)據(jù)庫與 litiw 控件得使用 三、 需求 分析 使用 slie 數(shù)據(jù)庫,使用 listviw 控件顯示物品 四、 實(shí)驗(yàn) 過程 1. 創(chuàng)建 程序, 設(shè)計(jì) 用戶交互界面 ?xl sion= 、 0 ecdig= t 8? lnealayut xmlns:ndod= ndrd:layou_wdth c pare t
2、androi:yu_height= m c _par nt droid:oientao= rt c l lirat nroid:lyo_wid=mat h p rent andoid:ayout_h0d nid:layout_weht=1 androd:orienato= rtica tetvew aoi:ayut_wd= rap_c te t anro:authigh=wrap_ on ent adrid:txt= 物品清單 inrout adroid:ayouwdth= _ aren no:lat_ight= r p_ nt n anroid:orientaion= or zont l t
3、extview ni:layutwidh=wra cont nt andoi:lyouthght= rap_content android:text= 物品名稱 / dittext nrid:d=+ /id_e stu fnam anroid:lyout_width=mat h p re anroid:layo_heigt= wrap_con ent nrid:inputypetext/ /lnarlayout lnerlayout andri:lyut_idth m t h_parent androi:layo_heigh=wr _c ntent androi:rienation=ho i
4、ontal textiew aroid:laout_widthwrap_c ntent anrod:layut_hght=wr p_conte t androi:tex 物品個數(shù) / editext androd:id= i /id t tuffam un andoid:layoutdt= ch_p rent ndoid:laoteigwra _con ent nroid:iputype=tex / /linearlyot linerlaout aroid:layutwidt t h_par nt andri:lyoutheiht ra ontent adroid:orientationhor
5、izont xtviw androi:layout_t= ap_c nt nt anri:layo_eight=wrap conten andrd:tet= 物品價(jià)格 / edttext android:id=+id id_et stuff ri android:ayotwidth atc _ ar nt ndrod:layout_height= ra _content nrid:nutype=tex / /linearlaout /linarlao felyout androi:lyoutwidth= tch_pa ent ndrod:laout_heit ap c n ent linear
6、lyout android:layouwidt atch_ arent andoid:louheightm tch_p rent aoid:oretation= hori on al btton anroid:=+i /id_b _ dd android:ao_widh0dp ndroid:laytheight=wra _c ntent adoid:layou_weight= 1 ndroid:tex= 添加記錄 doi:lyot_aginft= 0d adri:layut_argight dp anoid:layumarintop6dp andoid:laut_mrgnbotom= d ad
7、ri:ravty=cen adroid:padding p anrid:textor 27272 anroi:bakground= ra bl /r cord utt n adroid:minheigh=0 p/ button ndroid:d=+id/id_bt_ ll andid:layoutwih=0dp adroid:lout_height=w ap_cont n andrd:layout_eight=1 andrid:ext= 顯示全部 anrid:layout_mrgieft=10 p ano:layout_argirght1 d anrod:lout_agintop= dp an
8、droid:layu_aiboo=7dp anroid:graity=cen er andro:pddg5dp ndro:teto#72727 aroid:bakgound= r ab e/ ecordbut on andoid:mnhigh=0d / /inearlaut vew android:lyout_wthmatch_parent ani:layout_heih= dp d:bakground= ee/ /famlayot /inrlayt 2 、 創(chuàng)建 li tview i em 布局 ?l vion=1 、 0 encoding= f-8? linealayout xmn:anr
9、oi= ndr:layut_width=m t h_p r nt android:ayot_eit= atch parent anroid:ientatin= hor z n l andod:backgrund=# f ffff imageview anrid:id=+ d/id_ig_name andoid:layoutwdth0dp andrid:lut_heiht=wrap_co andr:layut_wght1 android:src=dr w le/ c m nu_ aste_holo lig t/ tetview andri:id +i tv_na e nri:yt_width0d
10、p adi:laout_eight=w p_co te t andrd:ayou_weigh=1 ndroid:txtlo=#000 00 android:textsze= 8sp/ textview droi:id=+id/ d_tv a o n android:laut_wi= andoid:ayout_hight=wra _ o ent android:layoutwigt=1 andoid:textolo= 0 00 droid:tetz=1 s / xte adri:d=+id id_ v p ice ndroid:aot_width=0d ndoid:laout_heigt=wr
11、p_ on en ndrd:layou_ght1 androi:textolor 000 00 anoid:textize=1 sp igebuo aod:d=+id/id b_delete andr:laou_width=0dp doi:layoheht=wrap con ent adri:yot_eiht1 andri:src=drawable/ic_men _dele e droid:bkgrod#f ffffff doid:oclk eteitem /linealayout 、創(chuàng)建 數(shù)據(jù)庫 paca 、li、suff; iot anr、connt、contet; mport ndrd、
12、atabse、slite、litdabae; irt andri、aae、qite、qltdatabse、ursorfactor; mor androd、aabase、slite、qiteoenhlper; pui clas mslitopenelpr tnd sqlitpnhele pubic mliteopeelpr(ontext cntt ) super(context, lqi、b, nl, 1); / todo autogenert cosruct stub overrid )d esabatdtilqs(etrcn diov bup ,tnmercotua yk yrairp re
13、tni d(iqil elat etec(lqcexe、bdstuff,amou,rce); drevo pulic o onupgade(sqlitedatab d, int ldverso, int nversio) / buts dohte detarne-ta odot 、創(chuàng)建 acc t unt 類 c age 、lq、stuf; publi class stuff p te trg stuffname; ivat i tufmun; private floa tufprc; u li srin gstuffnme() uter stuffnme; publi id setstuff
14、ame(stig stuffm) hi 、tuffname = stuname; ublic nt gttuffamou() r urn tffamun; public voi setstufamount(int stufamut) stuffaunt stuffamunt; pub ic loat getstufpric() e urn stuffprice; publi voi setsfpre( lo t stuffpri) ;ecpfuts = ciruts 、創(chuàng)建 數(shù)據(jù)操作邏輯 pkage 、liqi、stu; imt java、uti、rrayis; imrt java、i、ist
15、; mot adoid、p、activy; imort anroid、ataase、cuso; rt ndroid、daas、lte、sqledataase; iot andoi、os、bdl; imort andrid、ie、ve; imrt ndrid、vew、iew、onclicklisee; port andrd、vw、viewgrop; impot anroid、widgt、basaaptr; prt andr、wdgt、imagebton; imprt andod、ide、imageviw; impor ndroid、wiget、listvew; import andro、wige
16、t、textview; ir adrod、wige、toast; puli cls stfls xtends aiviy ;v weivtsil tair ;eabatadm eadetiqs trp rivat lststuffstufnfos; ;epehm replepotilqm etavirp overrie ptected void oncrete(unde svedstancsta) ;)llawoh、oyal、r(wivtntnoctes ;)sit(replehnpoelqm n=relem ;)vl_d、di、(diybweidnif )ivtsil(=l all(); s
17、uper、ncreate(avinstncestate); publi void all() dabae=hepe、getwritabedaabae(); n ,llu ,lun ,ln ,lln ,iqi(yr、esabtad=osuc rsrucl, nll); stuffinfosew araylitsff(); hi(cursor、movetonxt() uff stuffnew stuff(); ;))1(girtstg、rruc(effutes、futs u、setstuffamout(curo、getit(2); uf、etstufrice(crso、getflat(3); st
18、uffifos、d(tu); crr、lose(); mdabase、close(); ;)(etadaym (retpadates、vl class myadaper xens aseadapte edivo )(tnocte tni cilbup ;)(zis、sofnffut nrter erride pulc obct gettem(i posion) buts dotm dtarene-oua odot retrn nul; edirv )noisop tni(dimeg gnl cilup / buts dohte detrneota odt ;0 nrter edirrevo )
19、tnea puorweiv , weiv weiv ,noitisp tni aif(weivtg wei cilbup viw ie、nfe(list、tis, r、aot、stf_item, nll); ;)eman_vt_d、di、(dybwvdif、 w )eivtxet(envt wevtxet tetview v_aoun=(txtve)i 、 finvwbi(r、id、idtvamount); ;)crpt_di、i、r(diybeivdif、 weiv )eivtxet(=ecrp_vt wevte iagebutto ibuo=(imaebutton) view、findvi
20、ewbyi(、id、d_delete); ;)(efftg、)noiisp(te、fnifus(txetts、emanvt tv_amon、ett(數(shù)量(個)stuffifos、t(ition)、tsaoun(); pfftteg、)oitiso(tg、nifs)元(價(jià)單(txees、cirpvice(); buton、stocicklister(w onclckistener() overre )v wei(ilcno diov ilbup mataae=mhep、gtwitabledatabase(); p(teg、sofnift git wen ,?ffus,iqi(etld、esaat
21、admition)、etstfname(); ;)(esol、esaata ;)noiis(eom、sofnifuts yadapter、tis、notiydasetchanged(); ;) ;weiv nrter 6 6 、編寫 界面交互代碼 pakag 、lii、stuff; imp adoid、ap、ctiit; imrt ndrod、conen、contentvales; im andrd、conent、intent; por andrd、dabae、qlite、qlitedatabase; imor andid、o、budl; imr nrid、iew、ew; mport aoid
22、、viw、view、nlickstene; imprt ndod、wdget、button; port anroid、idet、eittext; import anroid、dt、toat; public clas mnctivi exends activiy iln oclickser pvae msqteopnhelp helr; rie qlitetabse mdataba; rivate buton t_ad,t_all; prae ittet et_tuffnme,ttufamout,et_tufpie; eirrev prtced void oncet(bundle svedina
23、ncetate) supr、oncreate(saveditanestat); ;)atad_dda、tuoyl、r(weitnetnotes ;)iht(rplehepoetilqsym wen=repleh ;)(wevtin ;)(noicaini pui oi intview() ;)effuts_te_d、di、r(diybwvdnif )xttide(=emanffuts_t tsufmot=(ditet) fndewyid(r、id、id_e_tuffamut); et_stufpe=(edittxt) findviwbyid(r、i、i_et_tffprize); bt_ad=
24、(buon) fidiewbid(r、d、id_ta); ;)la_t_di、di、(dybweivdnif )notb(=lla_tb ubli voi inition() btadd、setnclickistener(hi); bt_al、setonllsener(this); dev )v iv(kciln diov ilp switch (v、g() :dda_tb_di、di、r esa ;)(da rek; :llatb_i、di、r esa ;)sal、silts,sih(ntni =tntni netni ;)netn(ytivitcatras ;aerb publc vid
25、ad() ;)(mt、)(gnirtsot、)(txteg、emanffts_t=emanfuts gnirts 、)(irtot、)(txtteg、tnuomafuts_te(tirap、regetni=uomafuts tirim()); float stuffpce=floa、parselt(e_stufrice、gettex()、osting()、tm(); sff tuf=w stuff(); ;)emanffus(enffuste、fus ;)tnuoffuts(nuoffutses、ffut ;)ecipffts(rpffstes、futs ;)(esabaadelbaireg、replehm=esbatd ;)(suaveto esulavetnoc seuavtnenoc ;
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2020-2021深圳育才中學(xué)(初中)小學(xué)三年級數(shù)學(xué)下期末一模試卷帶答案
- 安裝鐵塔施工方案
- 2024年黑龍江大慶中考滿分作文《詩中誦出赤子心》
- 個人購銷合同范例范例
- 修路個人勞務(wù)合同范例
- 合伙餐廳合同范本
- 跨部門合作的工作計(jì)劃實(shí)例
- 鄉(xiāng)村樹苗銷售合同范例
- 學(xué)生自我管理與目標(biāo)追蹤計(jì)劃
- 培養(yǎng)員工潛能與激勵方式計(jì)劃
- 勞務(wù)派遣勞務(wù)外包項(xiàng)目方案投標(biāo)文件(技術(shù)方案)
- 2025年安全員C證(專職安全員)考試題庫
- 地理-天一大聯(lián)考2025屆高三四省聯(lián)考(陜晉青寧)試題和解析
- 2025年廣州市公安局招考聘用交通輔警200人高頻重點(diǎn)模擬試卷提升(共500題附帶答案詳解)
- 貴州省貴陽市2024-2025學(xué)年九年級上學(xué)期期末語文試題(含答案)
- 2025年江蘇海事職業(yè)技術(shù)學(xué)院高職單招職業(yè)適應(yīng)性測試近5年??及鎱⒖碱}庫含答案解析
- 2024年尖葉菠菜種子項(xiàng)目可行性研究報(bào)告
- 計(jì)件工資計(jì)算表格模板
- 兩癌防治知識培訓(xùn)
- 《moldflow學(xué)習(xí)資料》課件
- 2025中國移動安徽分公司春季社會招聘高頻重點(diǎn)提升(共500題)附帶答案詳解
評論
0/150
提交評論