安卓开发课程设计报告_第1页
安卓开发课程设计报告_第2页
安卓开发课程设计报告_第3页
安卓开发课程设计报告_第4页
安卓开发课程设计报告_第5页
已阅读5页,还剩17页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、武汉理工大学华夏学院课 程 报 告课程名称:智能手机软件开发题 目: 基于android的手机通讯录的设计与实现专 业 信息工程系 班 级 学 号 姓 名 成 绩 指导教师 2015年3月23日至2015年6月12日智能手机软件开发大作业 根据所学的android 手机开发的知识,采用eclipse、java开发一个基于android平台的手机通讯录软件,具体要求如下: 1.要发该软件能够在android4.0 以上的平台上运行。 2.要求软件界面美观,操作方便,符合日常使用规范。 3.能够通过该手机通讯录来添加新的联系人,用来存放联系人的姓名、单位、电话、qq、地址等信息。 4.能够通过该手

2、机通讯录来编辑联系人信息,来修改联系人的个人信息。 5.能够通过该手机通讯录来调用系统的通信接口,直接给用户发短信,打电话。 6.在手机通讯录中,添加合适的菜单,来操作手机通讯录。7.将开发的过程写成报告,要求内容完整,格式规范,条理清晰。 1 设计目的 随着手机通讯录功能的不断加强与完善,手机通讯录对于人们的意义,已不仅仅像记事簿一样显示通讯地址,而是向着个性化、人性化的方向发展移动终端的应用软件和需要的服务将会有很大的发展空间。根据这个特点,设计一个基于android平台的通讯录系统,能根据手机的特点,存储,管理,修改联系人信息,并且能够根据选定的联系人,对其拨打电话,发送短信等。 手机通

3、讯录作为手机的基本功能之一,每天我们都在频繁地使用着。根据手机功能使用调查显示,通讯录从无到有,从英文到中文,经过了十几年的发展历程,今后的发展趋势就是从通讯录发展为名片夹,也就是在一个人名下,可以存储座机、手机、单位、地址、电子邮件等内容。所以手机通讯录功能越来越齐全,满足了人们的需求。2 开发环境由于该android通讯录是一个基于java语言开发软件,所以选择了eclipse3.4作为开发平台,作为插件,它能够安装android sdk,从而可以安装使用android虚拟机,使得程序得以开发,亦更为方便。本通讯录系统就是在eclipse3.4+android平台环境下编写设计而成的。3

4、需求分析 该系统针对的主要用户是android手机用户。android手机通信管理系统包括以下主要内容:(1) 用户通过联系人功能可以保存联系人的详细信息,可以对联系人进行编辑、删除、拨打电话、发送短信可以根据索引条件搜索联系人。(2) 用户通过短信记录功能可以发送短信,删除短信记录。(3) 用户通过sd卡所储存信息向通讯录批量导入联系人信息。(4) 用户通过个人中心可以设置自己的详细信息,这样方便其他人了解自己,也可以将具有相同名字的联系人合并。 要设计一个良好的手机通讯录,就必须首先明确该应用环境对系统的要求。android手机通讯录应用背景:方便用户快捷通讯。(1)类似于传统手机通讯录的

5、联系人的添加、修改、查找、删除功能。(2)指定联系人后,录音并发送给该联系人的留言功能。(3)通过通讯录访问联系人的微博以实现与联系人互动的功能。(4)接收短信、电话、语音留言和微博留言的信息并提醒用户。(5)保存用户自身的个人信息以用于与他人联系时显示身份。4 概要设计 下面数据流图是对于android手机通讯管理软件主要功能模块包括的简单结构图:联系人查看、联系人编辑、联系人添加、联系人删除、呼叫、发送短信、搜索,如图所示:android手机通讯 通讯列表搜索呼叫删除添加查看编辑发送短信 图4.1 android手机通讯管理软件主要功能模块联系人列表界面主菜单中包括添加联系人、搜索联系人、

6、关于及查看系统版本号、退出菜单项。点击添加联系人,则进入联系人添加界面,添加成功后返回列表界面。点击搜索菜单,则进入联系人搜索界面,输入联系人的全名或一个字,即可查找相关联系人,点击联系人会进入联系人查看界面,可以对联系人进行编辑、删除、拨打电话、发送短信。如下图所示的android手机通讯管理软件业务流程图.开始选则功能编辑搜索发送短信拨打电话删除新建更新数据库选中条目输入搜索条件结束输入新建联系人信息后保存显示搜索结果图4.2 android手机通讯管理软件业务流程图5 数据库设计5.1 sqlite数据库简介sqlite,是一款轻型的数据库,是遵守acid的关联式数据库管理系统,它的设计

7、目标是嵌入式的,而且目前已经在很多嵌入式产品中使用了它,它占用资源非常的低,在嵌入式设备中,可能只需要几百k的内存就够了。它能够支持windows/linux/unix等等主流的操作系统,同时能够跟很多程序语言相结合,比如 tcl、c#、php、java等,还有odbc接口,同样比起mysql、postgresql这两款开源世界著名的数据库管理系统来讲,它的处理速度比他们都快。sqlite第一个alpha版本诞生于2000年5月. 至今已经有10个年头,sqlite也迎来了一个版本 sqlite 3已经发布。本系统采用的是android系统自带的sqlite轻型数据库数据库。因此占用资源非常小

8、。5.2 数据库表结构首先创建数据库,在数据库中创建表用来存储联系人数据,其中包括联系人姓名、手机号、qq、地址等联系方式。6 详细设计与实现6.1联系人浏览模块6.1.1进入首界面,显示联系人列表。点击某个联系人会进入查看联系人界面,可以查看联系人的详细信息,对联系人进行编辑、删除、拨打电话发送短信等。截图所示:图 6.1.1 通讯录联系人列表模块界面6.1.2点击菜单按钮时,就会显示添加、查找、关于和退出功能。如果点击退出菜单,则会退出该软件。如图所示:图6.1.2 通讯录主菜单项模块6.1.3长按菜单显示android手机通讯截图如图所示:图6.1.3 通讯录联系人界面菜单模块6.2查看

9、联系人模块6.2.1在联系人界面点中击某个联系人,则会跳转到该界面。该软件实现了给联系人拨打电话和发送短信的功能。查看联系人界面截图如图所示:图6.2 手机通讯查看联系人模块界面6.3编辑联系人模块6.3.1联系人编辑界面设置了返回列表菜单和删除联系人菜单。点击返回列表菜单,会返回到联系人浏览界面。编辑联系人界面如图所示:图6.3 手机通讯录编辑联系人界面模块6.4查找联系人模块查找到所有包含该部分的联系人,并在listview中显示出来所有的联系人的姓名和手机号码,截图如图所示:图6.4 通讯录查找联系人模块界面7 总结 这学期的智能手机开发课程的学习,让我了解到手机开发端应用的广泛性,以及

10、对自己所学知识的总结,做手机通讯录,让我了解到手机已经成为日常生活中不可分割的一部分,所以手机上的功能满足人们的需求,才是手机通讯录开的重要性。对于这次的课程设计,使我发现了自己所掌握的知识是真正如此的缺乏,自己综合应用所学的专业知识能力是如此的不足通过这次开发项目,我们学会了如何在一个项目中集成多种技术,如何合理的耦合各种小功能,如何解决各种开发中出现的问题。同时在这次开发中出现的问题也暴露出了我们对java程序设计的一些问题,以及自己的动手能力还需要提高,而且做一个项目首先要明白这个项目的中心思想,这样才有目的去设计。 通过课程设计,使我深深体会到,干任何事都必须耐心,细致,课程设计过程中

11、,许多迷惑有时不免令我感到有些心烦意乱,有几次因为不小心而出错,只能毫不情意地重来。但一想起老师对我们耐心的教导,认真对待的良好习惯.这次课程设计使我在工作作风上得到了一次难得的磨练,一个人的性格很大程度上决定一件事情的进展以及对工作的态度和生活的态度,所以养成好的习惯能够帮助我克服各种苦难,能够帮助我在今后的学习中脚踏实地的工作。通过这次手机开发通讯录课程设计,我能够更加深刻的了解到手机通讯录开发的前景以及所需的知识,总之在今后的学习中自己应该了解如今社会上开发手机通讯录所需的最新的技术,不能一成不变,只看书本上的知识,养成自我学习的良好习惯。8 参考文献1 罗伟. 基于 android平台

12、的即时通讯系统的研究与实现d.湖南师范大学, 2009.2 李刚,疯狂java讲义,电子工业出版社,20083 程峰,java核心技术,机械工业出版社,20074 王鹏,java语言程序设计,大连理工出版社,20059 附录源代码public class dbhelper /* *操作数据库和各个表 */ public static final string database_name=contact_db; public static final string table_contacter=contact_person; public static final string table_m

13、obliephone=phone_number; public static final string table_group=mygroup; public static final string table_email=email; public static final string table_qq=qq; public static final string table_homephone=home_phone_number; public static final string table_address=address; public static final string ta

14、ble_fax=fax; /创建表的sql语句 public static string createtabelsql; private static sqlitedatabase dbinstance; public static final int version = 4; private mydbhelper mydbhelper; private context context; public dbhelper(context context,string createtablesql) this.context=context; this.createtabelsql=createt

15、ablesql; public dbhelper(context context) this.context=context; /* * 打开数据库 */ public void opendatabase() if(dbinstance=null) /创建数据库 mydbhelper= new mydbhelper(context, database_name, version); dbinstance=mydbhelper.getwritabledatabase(); /* 返回所有联系人 */ public arraylisthashmap getallcontacter(string c

16、ondition) arraylisthashmap contaclist = new arraylist(); cursor cursor; if(condition=null|condition.trim().equals() cursor=dbinstance.query(table_contacter, new stringid,name,headimage, null, null, null, null, null); else stringbuffer sqlbuffer=new stringbuffer(); sqlbuffer.append(select id,name,hea

17、dimage from ) .append(table_contacter) .append( where name like %) .append(condition) .append(%); cursor=dbinstance.rawquery(sqlbuffer.tostring(), null); cursor.movetofirst(); while(!cursor.isafterlast() hashmap item=new hashmap(); item.put(contacter_id, cursor.getint(cursor.getcolumnindex(id); item

18、.put(name, cursor.getstring(cursor.getcolumnindex(name); item.put(headimage, cursor.getstring(cursor.getcolumnindex(headimage); /返回第一个手机电话号码 cursor phonecursor=dbinstance.query(table_mobliephone, new stringphone_number, id=?, new stringstring.valueof(cursor.getint(cursor.getcolumnindex(id), null, nu

19、ll, null); phonecursor.movetofirst(); item.put(phonenumber, phonecursor.getstring(phonecursor.getcolumnindex(phone_number); contaclist.add(item); cursor.movetonext(); return contaclist; /* * 根据编号返回一个联系人 */ public contacter getcontacter(int id) contacter contacter = new contacter(); cursor contacterc

20、ursor =dbinstance.query(table_contacter, new stringid,group_name,name,nick_name,birthday,workingunits,headimage, id=?, new stringstring.valueof(id), null, null, null); contacter.id=id; contactercursor.movetofirst(); =contactercursor.getstring(contactercursor.getcolumnindex(name); conta

21、cter.nickname=contactercursor.getstring(contactercursor.getcolumnindex(nick_name); contacter.workingunits=contactercursor.getstring(contactercursor.getcolumnindex(workingunits); if(contactercursor.getstring(contactercursor.getcolumnindex(birthday).trim()!=null &!contactercursor.getstring(contactercu

22、rsor.getcolumnindex(birthday).trim().equals() string string=contactercursor.getstring(contactercursor.getcolumnindex(birthday).trim(); contacter.birthday=date.valueof(contactercursor.getstring(contactercursor.getcolumnindex(birthday); contacter.headimage=contactercursor.getint(contactercursor.getcol

23、umnindex(headimage); /联系人的手机号码 cursor phonecursor =dbinstance.query(table_mobliephone, new stringphone_number, id=?, new stringstring.valueof(id), null, null, null); phonecursor.movetofirst(); contacter.mobilephone=new stringphonecursor.getcount(); for(int i=0;iphonecursor.getcount();i+) contacter.m

24、obilephonei=phonecursor.getstring(phonecursor.getcolumnindex(phone_number); phonecursor.movetonext(); /联系人的座机号码 cursor homephonecursor=dbinstance.query(table_homephone, new stringhome_number, id=?, new stringstring.valueof(id), null, null, null); homephonecursor.movetofirst(); contacter.homephonenum

25、ber=new stringhomephonecursor.getcount(); for(int i=0;ihomephonecursor.getcount();i+) contacter.homephonenumberi=homephonecursor.getstring(homephonecursor.getcolumnindex(home_number); homephonecursor.movetonext(); /联系人的email cursor emailcursor=dbinstance.query(table_email, new stringemail, id=?, new

26、 stringstring.valueof(id), null, null,null); emailcursor.movetofirst(); contacter.email=new stringemailcursor.getcount(); for(int i=0;iemailcursor.getcount();i+) contacter.emaili=emailcursor.getstring(emailcursor.getcolumnindex(email); emailcursor.movetonext(); /联系人的传真号码 cursor faxcursor=dbinstance.

27、query(table_fax, new stringfax_number, id=?, new stringstring.valueof(id), null, null,null); contacter.faxnumber=new stringemailcursor.getcount(); faxcursor.movetofirst(); for(int i=0;ifaxcursor.getcount();i+) contacter.faxnumberi=faxcursor.getstring(faxcursor.getcolumnindex(fax_number); faxcursor.m

28、ovetonext(); /联系人的地址 cursor addresscursor=dbinstance.query(table_address, new stringadd_code,province,city,street,zip_code,country, id=?, new stringstring.valueof(id), null, null, null); addresscursor.movetofirst(); contacter.addresses=new addressaddresscursor.getcount(); for(int i=0;i0) for(string

29、email:contacter.email) flag&=insertemail(id, email); /插入qq if(contacter.email!=null&contacter.qq.length0) for(long qq:contacter.qq)flag&=insertqq(id, qq); /插入传真 if(contacter.faxnumber!=null&contacter.faxnumber.length0) for(string fax:contacter.faxnumber)flag&=insertfax(id, fax); /插入电话 if(contacter.m

30、obilephone!=null&contacter.mobilephone.length0) for(string phone:contacter.mobilephone)flag&=insertphonenumber(id, phone); /插入座机号码 if(contacter.homephonenumber!=null&contacter.homephonenumber.length0) for(string homephone:contacter.homephonenumber)flag&=inserthomephone(id, homephone); /插入地址 int i=0;

31、 if(contacter.addresses!=null&contacter.addresses.length0) for(address add:contacter.addresses) flag&=insertaddress(id, i+,vince, add.city, add.street, add.zip_code, add.coutry); return flag; /* * 更新联系人 */ public void updatecontacter(contacter contacter) /先删除记录 removecontacter(string.valueof(

32、contacter.id); /再重新插入 insertcontacter(contacter); /* * 删除联系人 */ public void removecontacter(string id) dbinstance.delete(table_email, id=?, new stringid); dbinstance.delete(table_fax, id=?, new stringid); dbinstance.delete(table_homephone, id=?, new stringid); dbinstance.delete(table_mobliephone, id

33、=?, new stringid); dbinstance.delete(table_qq, id=?, new stringid); dbinstance.delete(table_contacter, id=?, new stringid); /数据库插入函数 public boolean insertvaluestotable(string tablename,contentvalues values) if( (long) dbinstance.insert(tablename, null, values)=-1) return false; else return true; /*

34、* 往表中插入数据 */ /往group插入数据 public boolean insertgroup(string groupname) contentvalues values=new contentvalues(); values.put(group_name, groupname); if (insertvaluestotable(table_group,values) ) return true; else return false; /往contactperson表插入数据 public boolean insertcontactperson(int id, string grou

35、pname, string name, string nickname, date birthday, string workiingunits, int headimage ) contentvalues values=new contentvalues(); values.put(id, id); values.put(group_name, groupname); values.put(name, name); values.put(nick_name, nickname); values.put(birthday, birthday.tostring(); values.put(wor

36、kingunits, workiingunits); values.put(headimage, headimage); if (insertvaluestotable(contact_person,values) ) return true; else return false; /往email表插入数据 public boolean insertemail(int id,string email) contentvalues values=new contentvalues(); values.put(id, id); values.put(email, email); if (inser

37、tvaluestotable(email,values) ) return true; else return false; /往address表插入数据 public boolean insertaddress(int id, int add_code, string province, string city, string street, string zip_code, string country) contentvalues values=new contentvalues(); values.put(id, id); values.put(add_code, add_code);

38、 values.put(province, province); values.put(city, city); values.put(street, street); values.put(zip_code, zip_code); values.put(country, country); if (insertvaluestotable(address,values) ) return true; else return false; /往qq表插入数据 public boolean insertqq(int id,long qq_number) contentvalues values=n

39、ew contentvalues(); values.put(id, id); values.put(qq_number, qq_number); if (insertvaluestotable(qq,values) ) return true; else return false; /往fax表插入数据 public boolean insertfax(int id,string fax_number) contentvalues values=new contentvalues(); values.put(id, id); values.put(fax_number, fax_number); if (insertvaluestotable(fax,values) return true; el

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论