安卓课程表课程设计报告Word文件下载.docx

上传人:b****5 文档编号:20750688 上传时间:2023-01-25 格式:DOCX 页数:16 大小:3.30MB
下载 相关 举报
安卓课程表课程设计报告Word文件下载.docx_第1页
第1页 / 共16页
安卓课程表课程设计报告Word文件下载.docx_第2页
第2页 / 共16页
安卓课程表课程设计报告Word文件下载.docx_第3页
第3页 / 共16页
安卓课程表课程设计报告Word文件下载.docx_第4页
第4页 / 共16页
安卓课程表课程设计报告Word文件下载.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

安卓课程表课程设计报告Word文件下载.docx

《安卓课程表课程设计报告Word文件下载.docx》由会员分享,可在线阅读,更多相关《安卓课程表课程设计报告Word文件下载.docx(16页珍藏版)》请在冰豆网上搜索。

安卓课程表课程设计报告Word文件下载.docx

成绩

一、目的(本次课程设计的概要以及所涉及的知识点.)

1.课程表课程的添加与实现

2.记录笔记并可以查看

设计知识点:

数据库的数据的新增,查询,删除等,辅助类,上下文菜单的使用;

二、使用环境(本次实践所使用的平台和相关软件。

SDK:

(softwaredevelopmentkit)软件开发工具包.被软件开发工程师用于为特定的软件包、软件框架、硬件平台、操作系统等建立应用软件的开发工具的集合.因此,AndroidSDK指的是Android专属的软件开发工具包。

使用Eclipse进行android应用开发需要给Eclipse装ADT插件,这样Eclipse就可以和androidADT建立连接,可以在Eclipse中启动android模拟器进行程序调试等.

三、内容与设计思想

(1.设计思路2.主要功能说明3.主要的模块结构4.主要代码分析。

1。

课程与笔记是私有的,所以设置用户名与密码登陆,在课程表中应有一个显示界面,用于显示已添加的课程,点击新增按钮进入新增界面,用于增加新的课程,需添加上课的星期和课的节次,并检查当前是否有课,并提示。

保存后进入课表显示界面,查看课表。

笔记中有一笔记列表,显示创建笔记的时间和标题。

点开笔记可以查看详细内容。

也可以进行笔记的新增。

若长按笔记。

则可以进行删除操作。

2.登录进入菜单,若无用户,可以注册.

课程表,查看已经有课程,新增课程并保存.

笔记,查看已有笔记,查看详细笔记,新增笔记,删除笔记。

3。

整个程序包含两个大的模块:

课程表模块和笔记模块;

课程表中包含显示和新增两个模块;

笔记中有显示列表模块,新增模块,和查看模块

4.

(1)用户登录时,根据用户名与密码进入数据库中查询,若有返回值为1,表示有该用户,进行界面的跳转,进去菜单界面。

若返回值为0,则表示用户名或密码错误,并提示。

but_login。

setOnClickListener(newOnClickListener(){

publicvoidonClick(Viewarg0){

Stringputname=edit_putname。

getText().toString();

Stringputpassword=edit_putpassword.getText().toString();

Cursorcs=dbhelper。

login(putname,putpassword);

intm=cs。

getCount();

if(m==0){

Stringtips="

你输入的用户名或密码有误"

Toasttoast=Toast。

makeText(getApplicationContext(),tips,20000);

toast。

show();

}else{

Intentintent=newIntent(MainActivity。

this,MenuActivity.class);

intent.putExtra(”name”,putname);

MainActivity。

this.startActivity(intent);

}

});

(2)新增课程时,查询这一天的所有课程,若已有的课程和添加的课程节次相同则冲突,则提示这节已经有课,若无可进行添加,并跳转会课程表界面查看

Cursorcs=db.query(”schedule”,newString[]{”time”},”day='

”+day+”'

”,null,null,null,null);

cs。

moveToFirst();

while(!

cs。

isAfterLast()){

Stringcheck=cs.getString(cs。

getColumnIndex("

time"

));

if(check。

equals(timeclass)){

Stringtips=”这节已经有课"

Toasttoast=Toast。

makeText(getApplicationContext(),tips,20000);

toast.show();

return;

}

cs。

moveToNext();

}

cs.close();

Stringsql=”insertintoschedule(’couesename’,'

room’,'

week’,'

day'

,'

time’,’teachername’)"

+

”values('

"

+couesename+”'

+room+"

'

'

”+week+”'

+day+"

’,'

”+timeclass+"

”+teachername+”'

)”;

db。

execSQL(sql);

(3)通过上下文菜单的方法,长按笔记列表,会出现设置好删除菜单,通过onContextItemSelected响应菜单,并获得所选择的菜单。

通过info.targetView

查找到长按的视图,并获得TextView里的时间字符串,根据字符串进入数据库进行查找并删除,再跟新listView;

this。

registerForContextMenu(lv_notes);

publicvoidonCreateContextMenu(ContextMenumenu,Viewv,

ContextMenuInfomenuInfo){

menu。

add(0,1,0,"

删除”);

}

publicbooleanonContextItemSelected(MenuItemitem){

AdapterContextMenuInfoinfo=(AdapterContextMenuInfo)item。

getMenuInfo();

if(item。

getItemId()==1){

//获取当前的视图

TextViewtv=(TextView)info.targetView。

findViewById(R。

id。

tv_showwritetime);

Stringstr=tv.getText().toString();

Stringsql=”deletefromnoteswherewritetime=’"

+str+”’"

db。

execSQL(sql);

//通知更新显示ListV

cs=db。

query("

notes"

newString[]{"

_id"

"

writetime”,"

notesname"

},null,null,null,null,null,null);

adapter=newSimpleCursorAdapter(this,R.layout.notes_layout,cs,

newString[]{”writetime”,”notesname"

},

newint[]{R.id.tv_showwritetime,R.id.tv_shownotesname});

lv_notes。

setAdapter(adapter);

//adapter。

notifyDataSetChanged();

}

returnfalse;

(4)新建了一个DBHelper辅助类继承SQLiteOpenHelper,新建数据库,新建表格,并对数据进行增删改查.onCreate()方法是建立表格,只进行一次。

还可以根据版本号进行数据库的更新,在其他类中调用查询方法,并返回所查询的值。

publicclassDBHelperextendsSQLiteOpenHelper{

privatestaticfinalintVersion=1;

privatestaticfinalStringDBNAME="

cc"

;

privatestaticfinalStringsql_createschedule=”createtableschedule(_idintegerprimarykeyautoincrement,"

+"

couesenametext,”+”roomtext,"

weektext,”+

"

daytext,"

timetext,"

teachernametext)"

privatestaticfinalStringsql_createuserinformation=”createtableuserinformation(_idintegerprimarykeyautoincrement,"

+”nametext,”+"

passwordtext,"

imageidinteger)”;

privatestaticfinalStringsql_createnotes="

createtablenotes(_idintegerprimarykeyautoincrement,"

writetimetext,”+”notesnametext,”+”notestext)”;

publicDBHelper(Contextcontext){

super(context,DBNAME,null,Version);

publicvoidonCreate(SQLiteDatabasedb){

db.execSQL(sql_createschedule);

db。

execSQL(sql_createuserinformation);

db.execSQL(sql_createnotes);

publicvoidonUpgrade(SQLiteDatabasearg0,intarg1,intarg2){

publicCursorlogin(Stringputname,Stringputpassword){

SQLiteDatabasedb=this.getReadableDatabase();

Cursorcslogin=db。

userinformation"

,null,”name='

+putname+”’andpassword='

”+putpassword+”’"

,null,null,null,null,null);

returncslogin;

publicvoidaegister(Stringnewname,Stringnewpassword,intimageid){

SQLiteDatabasedb=this.getReadableDatabase();

Stringsql=”insertintouserinformation(’name’,’password'

,’imageid’)"

"

values('

+newname+"

’,’”+newpassword+”'

,’”+imageid+"

’)"

db.execSQL(sql);

publicCursorcheckname(Stringnewname){

Cursorcscheckname=db.query(”userinformation”,newString[]{”name"

},”name=’”+newname+"

”,null,null,null,null,null);

returncscheckname;

publicCursorqueryschedule(){

Cursorcsschedule=db。

schedule”,null,null,null,null,null,null);

returncsschedule;

publicvoidaddcosuses(Stringcouesename,Stringroom,Stringweek,Stringday,Stringtimeclass,Stringteachername){

SQLiteDatabasedb=this。

getReadableDatabase();

Stringsql=”insertintoschedule(’couesename'

,’room'

day’,'

time'

teachername'

)"

+"

”+couesename+"

’,’"

+week+”’,’"

+timeclass+"

,’”+teachername+"

publicvoidwritenotes(Stringwritetime,Stringnotesname,Stringnotes){

Stringsql=”insertintonotes(writetime,notesname,notes)values(’”+writetime+”’,'

”+notesname+"

+notes+”'

)”;

publicCursorquerynotes(){

Cursorcs=db。

query(”notes”,newString[]{"

_id”,"

writetime"

,”notesname"

},null,null,null,null,null,null);

returncs;

四、调试过程(测试结果分析)

若无用户点击注册,进行注册,注册界面需要输入两次密码,进行密码确认.

2。

注册后进入登录界面,经过用户名和密码验证过后进行登录进去菜单界面

3.进入菜单界面,选择相应的功能

4.选择课表后,进去课表界面,可以查看已有的课程,课程表可以滑动,点击新增,进入新增界面进行增加

5.进入新增后输入课程名教室等,若无冲突,点击勾就保存进入课表界面,查看课表

6。

进入笔记列表界面,若点击笔记,则可以查看该篇详细笔记,若长按,通过上下文菜单的方法进行删除,点击笔记按钮,则可进入写笔记界面

7。

进入新增笔记界面,获取当前的时间,并记录,方便查询。

8.点击笔记查看详细的笔记。

五、总结

1.设计中遇到的问题及解决过程

遇到了一些方法使用错误,通过网上的查找和询问高手解决的。

2.设计中产生的错误及原因分析

界面跳转是出现问题,经过排查后发现传递的参数有错。

3.设计体会和收获.

深深的感觉自己的知识经验匮乏。

虽然经常会报错,但是要慢慢的细心的排查,而且每天都要坚持写下去.要不断的学习,遇到难题,不会的,要咬着牙把它啃下了。

六、附录

1、原代码节略

2、参考文献

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

当前位置:首页 > 农林牧渔 > 林学

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

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