安卓课程表课程设计报告

上传人:枫** 文档编号:489927610 上传时间:2022-12-19 格式:DOCX 页数:17 大小:741.37KB
返回 下载 相关 举报
安卓课程表课程设计报告_第1页
第1页 / 共17页
安卓课程表课程设计报告_第2页
第2页 / 共17页
安卓课程表课程设计报告_第3页
第3页 / 共17页
安卓课程表课程设计报告_第4页
第4页 / 共17页
安卓课程表课程设计报告_第5页
第5页 / 共17页
点击查看更多>>
资源描述

《安卓课程表课程设计报告》由会员分享,可在线阅读,更多相关《安卓课程表课程设计报告(17页珍藏版)》请在金锄头文库上搜索。

1、南京晓庄学院【移动开发应用框架】 课程设计报告课程表的设计与实现所在院(系):信息工程学院学 号:13139173学生姓名:陈倡年级专业:软件工程指导教师:李青提交日期 :2015年12月课程设计实验报告班级13软工4姓名陈倡学号13139173任课教师李青实验日期2015.12成绩一、目的(本次课程设计的概要以及所涉及的知识点。)1 .课程表课程的添加与实现2 .记录笔记并可以查看设计知识点:数据库的数据的新增,查询,删除等,辅助类,上下文菜单的使 用;二、使用环境(本次实践所使用的平台和相关软件。)SDK: (software development kit)软件开发工具包。被软件开发工程

2、师用 于为特定的软件包、软件框架、硬件平台、操作系统等建立应用软件的开发工具 的集合。因此,Android SDK指的是Android专属的软件开发工具包。使用Eclipse进行android应用开发需要给 Eclipse装ADT插件,这样Eclipse 就可以和android ADT建立连接,可以在Eclipse中启动android模拟器进行程序 调试等。三、内容与设计思想(1 .设计思路2 .主要功能说明3 .主要的模块结构4 .主要代码分析。)1 .课程与笔记是私有的,所以设置用户名与密码登陆,在课程表中应有一个显 示界面,用于显示已添加的课程,点击新增按钮进入新增界面,用于增加新的 课

3、程,需添加上课的星期和课的节次,并检查当前是否有课,并提示。保存后 进入课表显示界面,查看课表。笔记中有一笔记列表,显示创建笔记的时间和 标题。点开笔记可以查看详细内容。也可以进行笔记的新增。若长按笔记。则 可以进行删除操作。2 .登录进入菜单,若无用户,可以注册。课程表,查看已经有课程,新增课程并保存。笔记,查看已有笔记,查看详细笔记,新增笔记,删除笔记3 .整个程序包含两个大的模块:课程表模块和笔记模块;课程表中包含显示和 新增两个模块;笔记中有显示列表模块,新增模块,和查看模块4 . (1)用户登录时,根据用户名与密码进入数据库中查询,若有返回值为 1, 表示有该用户,进行界面的跳转,进

4、去菜单界面。若返回值为 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

5、(); if (m=0) String tips =你输入的用户名或密码有误;Toast toast = Toast. makeText (getApplicationContext(),tips,20000);toast.show(); else Intent intent = new Intent(MainActivity.this ,MenuActivity. class );intent.putExtra( name , putname); MainActivity. this .startActivity(intent); );(2)新增课程时,查询这一天的所有课程,若已有的课程和添

6、加的课程节次相 同则冲突,则提示这节已经有课,若无可进行添加,并跳转会课程表界面查看 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(time );if (check.equals(timeclass)String tips =这节已经有课;Toast toast = Toast. mak

7、eText (getApplicationContext(), tips, 20000);toast.show(); return ; cs.moveToNext(); cs.close();String sql = insert into schedule(couesename,Toom,week,day,time,teachername)+ values( +couesename+ , +room+, +week+, +day+ , +timeclass+ ,+teachername+ );db .execSQL(sql);(3)通过上下文菜单的方法,长按笔记列表,会出现设置好删除菜单,通

8、过 onContextItemSelected响应菜单,并获得所选择的菜单。通过 info. targetView查找到长按的视图,并获得 TextView里的时间字符串,根据字符串进入数据库 进行查找并删除,再跟新listView ; this .registerForContextMenu(lv notes );public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) menu.add(0, 1,0,删除);public boolean onContextItemSelected(

9、MenuItem item)AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();if (item.getItemId()=1) /获取当前的视图 TextView tv = (TextView)info. targetView .findViewById(R.id. tv_showwritetime );String str = tv.getText().toString();String sql = delete from notes where writetime=+str+ ;db.execS

10、QL(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一 notesname二new int R.id.tv showwritetime,R.id.tv shownotesname);lv_notes .setAdapte

11、r( adapter );/adapter.notifyDataSetChanged(); return false ; (4)新建了一个DBHelper辅助类继承SQLiteOpenHelper ,新建数据库,新建表 格,并对数据进行增删改查。onCreate ()方法是建立表格,只进行一次。还可以根据版本号进行数据库的更新,在其他类中调用查询方法,并返回所查 询的值。public class DBHelper extends SQLiteOpenHelperprivatestaticfinalint Version = 1 ;privatestaticfinalString DBNAME=

12、 cc;privatestaticfinalString sql_createschedule=create tableschedule(_id integer primary key autoincrement,+ couesename text, + roomtext, +week text, +day text, +time text, +teachername text) ;private static final String sql_createuserinformation= create tableuserinformation(_id integer primary key

13、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 on

14、Create(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

15、 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 intouserinformation(name,password,imageid)+values( +newname+, +newpassword+ , +imageid+

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业/管理/HR > 营销创新

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号