安卓課程表課程設(shè)計(jì)報(bào)告_第1頁(yè)
安卓課程表課程設(shè)計(jì)報(bào)告_第2頁(yè)
安卓課程表課程設(shè)計(jì)報(bào)告_第3頁(yè)
安卓課程表課程設(shè)計(jì)報(bào)告_第4頁(yè)
安卓課程表課程設(shè)計(jì)報(bào)告_第5頁(yè)
已閱讀5頁(yè),還剩11頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、南京曉莊學(xué)院【移動(dòng)開(kāi)發(fā)應(yīng)用框架】課程設(shè)計(jì)報(bào)告課程表的設(shè)計(jì)與實(shí)現(xiàn)所在院 ( 系): 信息工程學(xué)院學(xué)號(hào): 13139173學(xué)生姓名: 陳倡年級(jí)專業(yè): 軟件工程指導(dǎo)教師: 李青提交日期:2015 年12月課程設(shè)計(jì)實(shí)驗(yàn)報(bào)告課程設(shè)計(jì)實(shí)驗(yàn)報(bào)告班級(jí)13軟工 4姓名陳倡學(xué)號(hào)13139173任課教師李青實(shí)驗(yàn)日期2015.12成績(jī)一、 目的( 本次課程設(shè)計(jì)的概要以及所涉及的知識(shí)點(diǎn)。)1. 課程表課程的添加與實(shí)現(xiàn)2. 記錄筆記并可以查看設(shè)計(jì)知識(shí)點(diǎn):數(shù)據(jù)庫(kù)的數(shù)據(jù)的新增,查詢,刪除等,輔助類,上下文菜單的使用;二、使用環(huán)境(本次實(shí)踐所使用的平臺(tái)和相關(guān)軟件。)SDK:(software development kit )

2、軟件開(kāi)發(fā)工具包。被軟件開(kāi)發(fā)工程師用于為特定的軟件包、軟件框架、 硬件平臺(tái)、 操作系統(tǒng)等建立應(yīng)用軟件的開(kāi)發(fā)工具的集合。因此, Android SDK 指的是 Android 專屬的軟件開(kāi)發(fā)工具包。使用 Eclipse 進(jìn)行 android 應(yīng)用開(kāi)發(fā)需要給 Eclipse 裝 ADT 插件,這樣 Eclipse 就可以和 android ADT 建立連接,可以在 Eclipse 中啟動(dòng) android 模擬器進(jìn)行程序調(diào)試等。三、內(nèi)容與設(shè)計(jì)思想( 1 設(shè)計(jì)思路 2主要功能說(shuō)明 3主要的模塊結(jié)構(gòu)4主要代碼分析。 )1. 課程與筆記是私有的,所以設(shè)置用戶名與密碼登陸,在課程表中應(yīng)有一個(gè)顯示界面,用于顯示

3、已添加的課程,點(diǎn)擊新增按鈕進(jìn)入新增界面,用于增加新的課程,需添加上課的星期和課的節(jié)次,并檢查當(dāng)前是否有課,并提示。保存后進(jìn)入課表顯示界面,查看課表。筆記中有一筆記列表,顯示創(chuàng)建筆記的時(shí)間和標(biāo)題。點(diǎn)開(kāi)筆記可以查看詳細(xì)內(nèi)容。也可以進(jìn)行筆記的新增。若長(zhǎng)按筆記。則可以進(jìn)行刪除操作。2. 登錄進(jìn)入菜單,若無(wú)用戶,可以注冊(cè)。課程表,查看已經(jīng)有課程,新增課程并保存。筆記,查看已有筆記,查看詳細(xì)筆記,新增筆記,刪除筆記。第頁(yè)共頁(yè)課程設(shè)計(jì)實(shí)驗(yàn)報(bào)告3. 整個(gè)程序包含兩個(gè)大的模塊:課程表模塊和筆記模塊;課程表中包含顯示和新增兩個(gè)模塊;筆記中有顯示列表模塊,新增模塊,和查看模塊4. (1)用戶登錄時(shí),根據(jù)用戶名與密碼

4、進(jìn)入數(shù)據(jù)庫(kù)中查詢,若有返回值為1,表示有該用戶,進(jìn)行界面的跳轉(zhuǎn),進(jìn)去菜單界面。若返回值為0 ,則表示用戶名或密碼錯(cuò)誤,并提示。but_login.setOnClickListener(new OnClickListener() publicvoidonClick(View arg0) String putname =edit_putname.getText().toString();String putpassword =edit_putpassword.getText().toString();Cursor cs =dbhelper.login(putname, putpassword);i

5、ntm = cs.getCount();if(m=0)String tips =" 你輸入的用戶名或密碼有誤" ;Toasttoast= Toast.makeText (getApplicationContext(),tips,20000);toast.show(); else Intent intent =new Intent(MainActivity.this,MenuActivity.class);intent.putExtra("name" , putname);MainActivity.this.startActivity(intent););

6、( 2)新增課程時(shí),查詢這一天的所有課程,若已有的課程和添加的課程節(jié)次相同則沖突,則提示這節(jié)已經(jīng)有課,若無(wú)可進(jìn)行添加,并跳轉(zhuǎn)會(huì)課程表界面查看Cursor cs =db .query("schedule",new String"time","day='"+day+ "'",null,null,null,null);cs.moveToFirst();while(!cs.isAfterLast()String check = cs.getString(cs.getColumnIndex("tim

7、e");if (check.equals(timeclass)String tips =" 這節(jié)已經(jīng)有課" ;Toast toast = Toast.makeText (getApplicationContext(),tips, 20000);toast.show();return;cs.moveToNext();cs.close();第頁(yè)共頁(yè)課程設(shè)計(jì)實(shí)驗(yàn)報(bào)告String sql ="insert intoschedule('couesename','room','week','day',&

8、#39;time','teachername')"+"values('"+couesename+ "','"+room+ "','"+week+ "','"+day+ "','"+timeclass+"','"+teachername+"')"db .execSQL(sql);( 3)通過(guò)上下文菜單的方法,長(zhǎng)按筆記列表,會(huì)出現(xiàn)設(shè)

9、置好刪除菜單,通過(guò)onContextItemSelected響應(yīng)菜單,并獲得所選擇的菜單。通過(guò)info.targetView查找到長(zhǎng)按的視圖,并獲得 TextView 里的時(shí)間字符串,根據(jù)字符串進(jìn)入數(shù)據(jù)庫(kù)進(jìn)行查找并刪除,再跟新 listView ;this.registerForContextMenu(lv_notes);publicvoidonCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) menu.add(0, 1,0," 刪除 " );publicbooleanonContext

10、ItemSelected(MenuItem item)AdapterContextMenuInfo info = (AdapterContextMenuInfo)item.getMenuInfo();if(item.getItemId()=1)/ 獲取當(dāng)前的視圖TextView tv =(TextView)info.targetView.findViewById(R.id.tv_showwritetime);String str = tv.getText().toString();String sql ="delete from notes where writetime='

11、"+str+"'"db .execSQL(sql);/ 通知更新顯示ListVcs = db .query("notes", new String"_id", "writetime", "notesname",null,null,null,null,null,null);adapter= new SimpleCursorAdapter(this,R.layout.notes_layout, cs ,new String"writetime", "n

12、otesname",new intR.id.tv_showwritetime,R.id.tv_shownotesname);lv_notes.setAdapter(adapter);/adapter.notifyDataSetChanged();returnfalse;( 4)新建了一個(gè) DBHelper 輔助類繼承 SQLiteOpenHelper ,新建數(shù)據(jù)庫(kù),新建表格,并對(duì)數(shù)據(jù)進(jìn)行增刪改查。 onCreate ()方法是建立表格,只進(jìn)行一次。還可以根據(jù)版本號(hào)進(jìn)行數(shù)據(jù)庫(kù)的更新,在其他類中調(diào)用查詢方法,并返回所查詢的值。publicclassDBHelperextendsSQLit

13、eOpenHelper第頁(yè)共頁(yè)課程設(shè)計(jì)實(shí)驗(yàn)報(bào)告privatestaticfinalintVersion = 1 ;privatestaticfinalStringDBNAME= "cc" ;privatestaticfinalStringsql_createschedule="create tableschedule(_id integer primary key autoincrement,"+ " couesename text,"+ " roomtext,"+"week text,"+&q

14、uot;day text,"+"time text,"+"teachername text)"privatestaticfinalStringsql_createuserinformation="create tableuserinformation(_id integer primary key autoincrement,"+" name text,"+"password text,"+"imageid integer)"privatestaticfinalSt

15、ringsql_createnotes="create table notes(_idintegerprimarykey autoincrement,"+ "writetimetext,"+"notesnametext,"+ "notestext)"publicDBHelper(Context context) super (context,DBNAME,null,Version);publicvoidonCreate(SQLiteDatabase db) db.execSQL(sql_createschedule

16、);db.execSQL(sql_createuserinformation);db.execSQL(sql_createnotes);publicvoidonUpgrade(SQLiteDatabase arg0,intarg1,intarg2) publicCursor login(String putname,String putpassword)SQLiteDatabase db =this.getReadableDatabase();Cursor cslogin = db.query("userinformation", null, "name='

17、;"+putname+ "'and password ='"+putpassword+"'", null, null, null, null, null);returncslogin;publicvoidaegister(String newname,String newpassword,intimageid)SQLiteDatabase db =this.getReadableDatabase();String sql ="insert intouserinformation('name',&

18、#39;password','imageid')"+" values('" +newname+ "','" +newpassword+ "','" +imageid+ "')" ; db.execSQL(sql);publicCursor checkname(String newname)SQLiteDatabase db =this.getReadableDatabase();Cursorcscheckname= db.query(

19、"userinformation", new String"name" ,"name = '"+newname+ "'",null,null,null,null,null);returncscheckname;publicCursor queryschedule()SQLiteDatabase db =this.getReadableDatabase();Cursorcsschedule= db.query("schedule",null,null,null,null,null,

20、第頁(yè)共頁(yè)課程設(shè)計(jì)實(shí)驗(yàn)報(bào)告null);returncsschedule;publicvoidaddcosuses(String couesename,String room,String week,Stringday,String timeclass,String teachername)SQLiteDatabase db =this.getReadableDatabase();String sql ="insert intoschedule('couesename','room','week','day','ti

21、me','teachername')"+ "values('"+couesename+ "','"+room+ "','"+week+ "','"+day+ "','"+timeclass+"','"+teachername+"')"db.execSQL(sql);publicvoidwritenotes(String writ

22、etime,String notesname,String notes)SQLiteDatabase db =this.getReadableDatabase();String sql ="insert into notes(writetime,notesname,notes)values('"+writetime+"','"+notesname+"','"+notes+ "')"db.execSQL(sql);publicCursor querynotes()SQLiteDatabase db =this.getReadableDatabase();Cursor cs = db.query(&q

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(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)論