




已閱讀5頁,還剩12頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
南 京 曉 莊 學(xué) 院【移動開發(fā)應(yīng)用框架】課程設(shè)計報告課程表的設(shè)計與實現(xiàn)所在院(系):信息工程學(xué)院學(xué) 號 : 13139173學(xué)生姓名 : 陳倡年級專業(yè) : 軟件工程指導(dǎo)教師 : 李青 提交日期 : 2015 年 12 月課程設(shè)計實驗報告班級 13軟工4姓名 陳倡學(xué)號 13139173任課教師李青實驗日期 2015.12成績一、 目的(本次課程設(shè)計的概要以及所涉及的知識點。)1.課程表課程的添加與實現(xiàn)2. 記錄筆記并可以查看設(shè)計知識點:數(shù)據(jù)庫的數(shù)據(jù)的新增,查詢,刪除等,輔助類,上下文菜單的使用;二、使用環(huán)境 (本次實踐所使用的平臺和相關(guān)軟件。 ) SDK:(software development kit)軟件開發(fā)工具包。被軟件開發(fā)工程師用于為特定的軟件包、軟件框架、硬件平臺、操作系統(tǒng)等建立應(yīng)用軟件的開發(fā)工具的集合。因此,Android SDK 指的是Android專屬的軟件開發(fā)工具包。 使用Eclipse進行android應(yīng)用開發(fā)需要給Eclipse裝ADT插件,這樣Eclipse就可以和android ADT建立連接,可以在Eclipse中啟動android模擬器進行程序調(diào)試等。三、內(nèi)容與設(shè)計思想 (1 設(shè)計思路 2 主要功能說明 3 主要的模塊結(jié)構(gòu) 4 主要代碼分析 。 )1.課程與筆記是私有的,所以設(shè)置用戶名與密碼登陸,在課程表中應(yīng)有一個顯示界面,用于顯示已添加的課程,點擊新增按鈕進入新增界面,用于增加新的課程,需添加上課的星期和課的節(jié)次,并檢查當(dāng)前是否有課,并提示。保存后進入課表顯示界面,查看課表。筆記中有一筆記列表,顯示創(chuàng)建筆記的時間和標(biāo)題。點開筆記可以查看詳細內(nèi)容。也可以進行筆記的新增。若長按筆記。則可以進行刪除操作。2.登錄進入菜單,若無用戶,可以注冊。課程表,查看已經(jīng)有課程,新增課程并保存。筆記,查看已有筆記,查看詳細筆記,新增筆記,刪除筆記。3.整個程序包含兩個大的模塊:課程表模塊和筆記模塊;課程表中包含顯示和新增兩個模塊;筆記中有顯示列表模塊,新增模塊,和查看模塊4.(1)用戶登錄時,根據(jù)用戶名與密碼進入數(shù)據(jù)庫中查詢,若有返回值為1,表示有該用戶,進行界面的跳轉(zhuǎn),進去菜單界面。若返回值為0 ,則表示用戶名或密碼錯誤,并提示。but_login.setOnClickListener(new OnClickListener() public void onClick(View arg0) String putname = edit_putname.getText().toString();String putpassword = edit_putpassword.getText().toString();Cursor cs = dbhelper.login(putname, putpassword);int m = cs.getCount();if(m=0)String tips = 你輸入的用戶名或密碼有誤;Toast toast = Toast.makeText(getApplicationContext(), tips,20000); toast.show();elseIntent intent = new Intent(MainActivity.this,MenuActivity.class);intent.putExtra(name, putname);MainActivity.this.startActivity(intent););(2)新增課程時,查詢這一天的所有課程,若已有的課程和添加的課程節(jié)次相同則沖突,則提示這節(jié)已經(jīng)有課,若無可進行添加,并跳轉(zhuǎn)會課程表界面查看Cursor cs = db.query(schedule, new Stringtime, day=+day+, null, null, null, null);cs.moveToFirst();while(!cs.isAfterLast()String check = cs.getString(cs.getColumnIndex(time);if(check.equals(timeclass)String tips = 這節(jié)已經(jīng)有課;Toast toast = Toast.makeText(getApplicationContext(), tips, 20000); toast.show(); return;cs.moveToNext();cs.close();String sql = insert into schedule(couesename,room,week,day,time,teachername) + values(+couesename+,+room+,+week+,+day+,+timeclass+,+teachername+);db.execSQL(sql);(3)通過上下文菜單的方法,長按筆記列表,會出現(xiàn)設(shè)置好刪除菜單,通過onContextItemSelected響應(yīng)菜單,并獲得所選擇的菜單。通過info.targetView 查找到長按的視圖,并獲得TextView里的時間字符串,根據(jù)字符串進入數(shù)據(jù)庫進行查找并刪除,再跟新listView;this.registerForContextMenu(lv_notes);public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) menu.add(0, 1,0, 刪除);public boolean onContextItemSelected(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=+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 Stringwritetime,notesname,new intR.id.tv_showwritetime,R.id.tv_shownotesname);lv_notes.setAdapter(adapter);/adapter.notifyDataSetChanged();return false;(4) 新建了一個DBHelper輔助類繼承SQLiteOpenHelper,新建數(shù)據(jù)庫,新建表格,并對數(shù)據(jù)進行增刪改查。onCreate()方法是建立表格,只進行一次。還可以根據(jù)版本號進行數(shù)據(jù)庫的更新,在其他類中調(diào)用查詢方法,并返回所查詢的值。public class DBHelper extends SQLiteOpenHelperprivate static final int Version = 1 ;private static final String DBNAME = cc;private static final String sql_createschedule = create table schedule(_id integer primary key autoincrement,+ couesename text,+ room text,+week text, +day text,+time text,+teachername text);private static final String sql_createuserinformation = create table userinformation(_id integer primary key autoincrement,+ name text,+ password text,+imageid integer);private static final String sql_createnotes = create table notes(_id integer primary key autoincrement,+writetime text,+notesname text,+notes text);public DBHelper(Context context) super(context, DBNAME, null, Version);public void onCreate(SQLiteDatabase db) db.execSQL(sql_createschedule);db.execSQL(sql_createuserinformation);db.execSQL(sql_createnotes);public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) public Cursor login(String putname,String putpassword)SQLiteDatabase db = this.getReadableDatabase();Cursor cslogin = db.query(userinformation,null,name=+putname+ and password =+putpassword+,null,null,null,null,null);return cslogin;public void aegister(String newname,String newpassword,int imageid)SQLiteDatabase db = this.getReadableDatabase();String sql = insert into userinformation(name,password,imageid) + values(+newname+,+newpassword+,+imageid+);db.execSQL(sql);public Cursor checkname(String newname)SQLiteDatabase db = this.getReadableDatabase();Cursor cscheckname = db.query(userinformation, new Stringname, name = +newname+, null, null, null, null, null);return cscheckname;public Cursor queryschedule()SQLiteDatabase db = this.getReadableDatabase();Cursor csschedule = db.query(schedule, null, null, null, null, null, null);return csschedule;public void addcosuses(String couesename,String room,String week,String day,String timeclass,String teachername)SQLiteDatabase db = this.getReadableDatabase();String sql = insert into schedule(couesename,room,week,day,time,teachername) + values(+couesename+,+room+,+week+,+day+,+timeclass+,+teachername+);db.execSQL(sql);public void writenotes(String writetime,String notesname,String notes)SQLiteDatabase db = this.getReadableDatabase();String sql = insert into notes(writetime,notesname,notes) values(+writetime+,+notesname+,+notes+);db.execSQL(sql);public Cursor querynotes()SQLiteDatabase db = this.getReadableD
溫馨提示
- 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 教育行業(yè)市場占有率表
- 美麗的心緒:初中語文作文教學(xué)與評價教案
- 外語課堂中的小組互動與合作學(xué)習(xí)效果研究
- 新能源領(lǐng)域發(fā)展動態(tài)表
- 小學(xué)生閱讀理解能力的提升方法
- 各地區(qū)產(chǎn)業(yè)園區(qū)建設(shè)情況表格
- DB14-T 3387-2025 邊雞保種技術(shù)規(guī)程
- 家鄉(xiāng)的變化發(fā)展議論文主題作文(8篇)
- 高空與低空交通融合對消費模式的創(chuàng)新
- 農(nóng)業(yè)經(jīng)濟管理體系建設(shè)協(xié)議
- 第十八章:爬行綱課件
- 《私域資產(chǎn)》讀書筆記
- 石油工業(yè)與環(huán)境保護概論智慧樹知到答案章節(jié)測試2023年中國石油大學(xué)(華東)
- 警用無人機考試題庫(全真題庫)
- 醫(yī)保業(yè)務(wù)知識題庫
- 等級醫(yī)院評審中應(yīng)注意的迎評禮儀
- 吉林省長春市東北師大附中明珠學(xué)校2023年物理八年級第二學(xué)期期末統(tǒng)考模擬試題含解析
- 【小升初】貴州省遵義市2022-2023學(xué)年人教版小學(xué)六年級下學(xué)期數(shù)學(xué)升學(xué)分班考測試卷(含解析)
- LD 52-1994氣瓶防震圈
- GB/T 35351-2017增材制造術(shù)語
- GB/T 18268.1-2010測量、控制和實驗室用的電設(shè)備電磁兼容性要求第1部分:通用要求
評論
0/150
提交評論