




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
畢業(yè)設(shè)計(jì)論文基于android的短信管理軟件學(xué)生姓名:指導(dǎo)老師:日期:
第一章緒論1.1研究背景目前,android操作系統(tǒng)已經(jīng)成為了手機(jī)操作系統(tǒng)的的主流,而作為一款的手機(jī)操作系統(tǒng),手機(jī)主要功能之一的短信功能是絕對(duì)不可缺少的。對(duì)于一個(gè)手機(jī)使用者來(lái)說(shuō)每天都會(huì)處理大量的短信息,諸如,朋友、家人、同事間短信,就算是從來(lái)不發(fā)短信,也會(huì)收到幾條廣告信息。在這個(gè)“時(shí)間就是金錢”的時(shí)代,速度就是決定一切的關(guān)鍵。
同時(shí),隨著微信,手機(jī)QQ等軟件的出現(xiàn),各種繁復(fù)新奇的功能令人們眼花繚亂輪,越來(lái)越多的人開(kāi)始通過(guò)其他軟件進(jìn)行聊天通訊,照里說(shuō)原本手機(jī)短信功能應(yīng)該顯得比較雞肋,然而事實(shí)并不是,因?yàn)榉N種原因,短信管理軟件雖然在功能上有所欠缺,但它依然占據(jù)著通訊工具的主流,其地位不可動(dòng)搖?;谝陨系脑颍_(kāi)發(fā)出能夠更快的和更方便的管理短信的軟件對(duì)于操作系統(tǒng)為人們所喜愛(ài)極為重要。1.2研究意義本課題的研究目的是開(kāi)發(fā)出一款在android操作系統(tǒng)下運(yùn)行的界面友好,操作方便,功能完善的手機(jī)短信收發(fā)管理軟件,能夠幫助用戶更好地管理短信,以便節(jié)省更多的時(shí)間。1.3開(kāi)發(fā)環(huán)境及工具開(kāi)發(fā)環(huán)境:win7工具:eclipse+sdk,jdk1.6,android手機(jī)1.4系統(tǒng)所需Android基本組件的介紹1.4.1Activity應(yīng)用程序中,一個(gè)Activity通常就是一個(gè)單獨(dú)的屏幕,它上面可以顯示一些控件也可以監(jiān)聽(tīng)并處理用戶的事件做出響應(yīng)。Activity之間通過(guò)Intent進(jìn)行通信。在Intent的描述結(jié)構(gòu)中,有兩個(gè)最重要的部分:動(dòng)作和動(dòng)作對(duì)應(yīng)的數(shù)據(jù)。典型的動(dòng)作類型有:MAIN(activity的門(mén)戶)、VIEW、PICK、EDIT等。而動(dòng)作對(duì)應(yīng)的數(shù)據(jù)則以URI的形式進(jìn)行表示。例如:要查看一個(gè)人的聯(lián)系方式,你需要?jiǎng)?chuàng)建一個(gè)動(dòng)作類型為VIEW的intent,以及一個(gè)表示這個(gè)人的URI。與之有關(guān)系的一個(gè)類叫IntentFilter。相對(duì)于intent是一個(gè)有效的做某事的請(qǐng)求,一個(gè)intentfilter則用于描述一個(gè)activity(或者IntentReceiver)能夠操作哪些intent。一個(gè)activity如果要顯示一個(gè)人的聯(lián)系方式時(shí),需要聲明一個(gè)IntentFilter,這個(gè)IntentFilter要知道怎么去處理VIEW動(dòng)作和表示一個(gè)人的URI。IntentFilter需要在AndroidManifest.xml中定義。通過(guò)解析各種intent,從一個(gè)屏幕導(dǎo)航到另一個(gè)屏幕是很簡(jiǎn)單的。當(dāng)向前導(dǎo)航時(shí),activity將會(huì)調(diào)用startActivity(IntentmyIntent)方法。然后,系統(tǒng)會(huì)在所有安裝的應(yīng)用程序中定義的IntentFilter中查找,找到最匹配myIntent的Intent對(duì)應(yīng)的activity。新的activity接收到myIntent的通知后,開(kāi)始運(yùn)行。當(dāng)startActivity方法被調(diào)用將觸發(fā)解析myIntent的動(dòng)作,這個(gè)機(jī)制提供了兩個(gè)關(guān)鍵好處:A、Activities能夠重復(fù)利用從其它組件中以Intent的形式產(chǎn)生的一個(gè)請(qǐng)求;B、Activities可以在任何時(shí)候被一個(gè)具有相同IntentFilter的新的Activity取代。1.4.2BroadcastReceive廣播接收器
你的應(yīng)用可以使用它對(duì)外部事件進(jìn)行過(guò)濾只對(duì)感興趣的外部事件(如當(dāng)電話呼入時(shí),或者數(shù)據(jù)網(wǎng)絡(luò)可用時(shí))進(jìn)行接收并做出響應(yīng)。廣播接收器沒(méi)有用戶界面。然而,它們可以啟動(dòng)一個(gè)activity或serice
來(lái)響應(yīng)它們收到的信息,或者用NotificationManager
來(lái)通知用戶。通知可以用很多種方式來(lái)吸引用戶的注意力──閃動(dòng)背燈、震動(dòng)、播放聲音等。一般來(lái)說(shuō)是在狀態(tài)欄上放一個(gè)持久的圖標(biāo),用戶可以打開(kāi)它并獲取消息1.4.3service服務(wù)一個(gè)Service是一段長(zhǎng)生命周期的,沒(méi)有用戶界面的程序,可以用來(lái)開(kāi)發(fā)如監(jiān)控類程序。比較好的一個(gè)例子就是一個(gè)正在從播放列表中播放歌曲的媒體播放器。在一個(gè)媒體播放器的應(yīng)用中,應(yīng)該會(huì)有多個(gè)activity,讓使用者可以選擇歌曲并播放歌曲。然而,音樂(lè)重放這個(gè)功能并沒(méi)有對(duì)應(yīng)的activity,因?yàn)槭褂谜弋?dāng)然會(huì)認(rèn)為在導(dǎo)航到其它屏幕時(shí)音樂(lè)應(yīng)該還在播放的。在這個(gè)例子中,媒體播放器這個(gè)activity會(huì)使用Context.startService()來(lái)啟動(dòng)一個(gè)service,從而可以在后臺(tái)保持音樂(lè)的播放。同時(shí),系統(tǒng)也將保持這個(gè)service一直執(zhí)行,直到這個(gè)service運(yùn)行結(jié)束。另外,我們還可以通過(guò)使用Context.bindService()方法,連接到一個(gè)service上(如果這個(gè)service還沒(méi)有運(yùn)行將啟動(dòng)它)。當(dāng)連接到一個(gè)service之后,我們還可以service提供的接口與它進(jìn)行通訊。拿媒體播放器這個(gè)例子來(lái)說(shuō),我們還可以進(jìn)行暫停、重播等操作。1.4.4ContentProvider內(nèi)容提供者android平臺(tái)提供了ContentProvider使一個(gè)應(yīng)用程序的指定數(shù)據(jù)集提供給其他應(yīng)用程序。這些數(shù)據(jù)可以存儲(chǔ)在文件系統(tǒng)中、在一個(gè)SQLite數(shù)據(jù)庫(kù)、或以任何其他合理的方式,
其他應(yīng)用可以通過(guò)ContentResolver類(見(jiàn)ContentProviderAccessApp例子)從該內(nèi)容提供者中獲取或存入數(shù)據(jù).(相當(dāng)于在應(yīng)用外包了一層殼),只有需要在多個(gè)應(yīng)用程序間共享數(shù)據(jù)是才需要內(nèi)容提供者。例如,通訊錄數(shù)據(jù)被多個(gè)應(yīng)用程序使用,且必須存儲(chǔ)在一個(gè)內(nèi)容提供者中。它的好處:統(tǒng)一數(shù)據(jù)訪問(wèn)方式。第二章短信管理系統(tǒng)的分析與設(shè)計(jì)2.1短信管理系統(tǒng)軟件架構(gòu)2.1.1特性功能分析一個(gè)好的短信管理系統(tǒng)要具備以下幾個(gè)特點(diǎn):
1.人性化的界面:
一個(gè)再優(yōu)秀、功能再齊全的系統(tǒng)如果界面做的極不美觀,那么就算它有完美的功能,也極少有人會(huì)去使用它。所以,一個(gè)人性化并且美觀的界面是一個(gè)優(yōu)秀的軟件必須所擁有的,好的界面將會(huì)擁有良好的用戶體驗(yàn),才會(huì)有更多的用戶去使用。
2.齊全的功能:
一個(gè)系統(tǒng)最重要的就是功能,如果沒(méi)有功能那就不是一個(gè)系統(tǒng)而只是一個(gè)空殼??梢哉f(shuō)功能就是軟件的本身,沒(méi)有功能就不成軟件。一個(gè)優(yōu)秀的短信管理系統(tǒng)所需要的功能是接收、發(fā)送短信,單一或者批量刪除短信,聯(lián)系人管理等。2.1.2基本功能分析根據(jù)軟件需求,方便軟件的開(kāi)發(fā)、維護(hù),切合模塊“高內(nèi)聚、低耦合”思想,特將短信管理系統(tǒng)分解為3個(gè)子系統(tǒng):短信接收與發(fā)送、短信查看管理,設(shè)置。系統(tǒng)功能結(jié)構(gòu)如圖1所示。將系統(tǒng)分解后,子系統(tǒng)模塊如表1所示表1子系統(tǒng)編號(hào)英文名稱中文名稱業(yè)務(wù)職能1Send_receive短信接收與發(fā)送短信的接受與發(fā)送2ManageMsg短信管理查看和管理短信3Setting設(shè)置設(shè)置界面短信管理軟件短信管理軟件短信收發(fā)短信管理選擇聯(lián)系人對(duì)話框顯示發(fā)送短信接收短信短信轉(zhuǎn)發(fā)短信列表顯示自定義界面刪除短信文件發(fā)送設(shè)置圖12.2短信管理系統(tǒng)各個(gè)模塊功能分析為了便于理解短信管理系統(tǒng)的各個(gè)功能,我們以表格的形式分析各個(gè)功能的作用。具體描述如表2所示表2模塊編號(hào)英文名稱中文名稱業(yè)務(wù)職能所屬子系統(tǒng)01SendMsg短信發(fā)送發(fā)送短信短信接收與發(fā)送02Receive短信接收接收短信短信接收與發(fā)送03ChoseContract選擇聯(lián)系人發(fā)送短信是在聯(lián)系人中選擇發(fā)送對(duì)象短信接收與發(fā)送04MsgClock消息提示接收到短信時(shí)發(fā)出提示音短信接收與發(fā)送05MsgList短信列表在主界面顯示聯(lián)系人短信列表短信管理06LookMsg對(duì)話框顯示與聯(lián)系人的對(duì)話短信管理07ResponseMsg短信回復(fù)回復(fù)短信短信管理08DeleteMsg刪除短信刪除短信短信管理09Repost轉(zhuǎn)發(fā)短信轉(zhuǎn)發(fā)短信短信管理10Transmit文件傳送傳送文件短信管理11InterfaceSetting界面設(shè)置選擇并設(shè)置界面設(shè)置2.3短信管理系統(tǒng)接口與數(shù)據(jù)庫(kù)設(shè)計(jì)2.3.1接口設(shè)計(jì)在短信收發(fā)需要與聯(lián)系人關(guān)聯(lián),同時(shí)需要將發(fā)送和收到的短信存入數(shù)據(jù)庫(kù),該系統(tǒng)的接口如表3所示:表3子系統(tǒng)編號(hào):1子系統(tǒng)英文名稱:Send_receive子系統(tǒng)中文名稱:短信收發(fā)接口編號(hào)接口名稱接口類型接口性質(zhì)相關(guān)對(duì)象1sendReceive發(fā)送接收短信并存入數(shù)據(jù)庫(kù)雙向用戶2contact選擇聯(lián)系人輸入在短信查看中主要需要查詢短信信息和回復(fù)短信,接口設(shè)計(jì)如表4所示表4子系統(tǒng)編號(hào):2子系統(tǒng)英文名稱:ManageMsg子系統(tǒng)中文名稱:短信查看接口編號(hào)接口名稱接口類型接口性質(zhì)相關(guān)對(duì)象1managerMsg查詢短信,根據(jù)聯(lián)系人刪除短信雙向用戶2transmit傳送文件輸出用戶在管理短信中主要的接口如表5所示表5子系統(tǒng)編號(hào):3子系統(tǒng)英文名稱:Setting子系統(tǒng)中文名稱:短信管理接口編號(hào)接口名稱接口類型接口性質(zhì)相關(guān)對(duì)象1setting設(shè)置界面用戶2.3.2數(shù)據(jù)庫(kù)設(shè)計(jì)概念結(jié)構(gòu)設(shè)計(jì)在此短信管理系統(tǒng)系統(tǒng)中設(shè)計(jì)用戶,短信,聯(lián)系人3個(gè)實(shí)體,其中用戶屬性包括姓名,短信屬性包括會(huì)話id,聯(lián)系人id,發(fā)件日期,號(hào)碼,是否閱讀,狀態(tài),內(nèi)容,類型,主題等,聯(lián)系人屬性有姓名、號(hào)碼,聯(lián)系人id。ER圖如圖2所示。聯(lián)系人聯(lián)系人發(fā)送接收內(nèi)容號(hào)碼id姓名聯(lián)系人id發(fā)件日期短信用戶查看刪除選擇類型對(duì)方號(hào)碼會(huì)話id姓名圖2:系統(tǒng)ER圖2.運(yùn)用設(shè)計(jì)Android的短信數(shù)據(jù)庫(kù)和聯(lián)系人數(shù)據(jù)庫(kù)在android操作系統(tǒng)中都是設(shè)計(jì)好,可以直接使用的,我們?cè)诰庉嫸绦殴芾碥浖r(shí)只要使用ContentProvider,通過(guò)url就可以直接調(diào)用數(shù)據(jù)庫(kù)中的表了。我在設(shè)計(jì)是主要用到的表是conversations和contacts。具體設(shè)計(jì)如表6,表7所示。表6表名字段名字段類型說(shuō)明conversations_idintegeridthread_idinteger會(huì)話idaddresstext對(duì)方號(hào)碼personinteger聯(lián)系人iddateinteger發(fā)件日期typeinteger短信類型,發(fā)送或接收bodytext內(nèi)容表7表名字段名字段類型說(shuō)明contacts_idintegeriddisplay_nametext聯(lián)系人姓名photo_idinteger照片idaddresstext電話號(hào)碼第三章短信管理系統(tǒng)的實(shí)現(xiàn)3.1界面層設(shè)計(jì)與實(shí)現(xiàn)短信管理系統(tǒng)主要有短信發(fā)送界面,短信列表界面和對(duì)話框界面。新建短信后的短信發(fā)送界面布局:短信列表顯示界面主要根據(jù)聯(lián)系人顯示短信,每個(gè)聯(lián)系人占據(jù)一列,列中顯示與該聯(lián)系人最新的聯(lián)系信息。短信列表顯示界面布局:對(duì)話框界面顯示該聯(lián)系人與用戶所有存儲(chǔ)的數(shù)據(jù)庫(kù)中的聊天信息,同時(shí)用戶可在最下方編輯并發(fā)送信息。對(duì)話框界面布局:3.2短信發(fā)送與接收設(shè)計(jì)與實(shí)現(xiàn)Android短信的發(fā)送與接收都是通過(guò)BroadcastReceive實(shí)現(xiàn)的,發(fā)送短信通過(guò)SmsManager的sendTextMessage()方法實(shí)現(xiàn)。短信發(fā)送成功后,發(fā)送的短信信息會(huì)被保存到數(shù)據(jù)庫(kù)中,同樣,當(dāng)手機(jī)通過(guò)BroadcastReceive接收到短信時(shí),也會(huì)將短信存入數(shù)據(jù)庫(kù)。具體代碼如下:sendMsg.java:publicclassSendMsgextendsActivity{ StringSENT_SMS_ACTION="SENT_SMS_ACTION"; StringDELIVERED_SMS_ACTION="DELIVERED_SMS_ACTION"; @Override protectedvoidonCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.sendmsg_main); ButtonbtnSend=(Button)findViewById(R.id.btnSend); btnSend.setOnClickListener(newOnClickListener(){ @Override publicvoidonClick(Viewarg0){ //TODOAuto-generatedmethodstub EditTexttelNoText=(EditText)findViewById(R.id.telNo); EditTextcontentText=(EditText)findViewById(R.id.content);//獲取參數(shù)值短信號(hào)碼和內(nèi)容 StringtelNo=telNoText.getText().toString(); Stringcontent=contentText.getText().toString(); SendSMS(telNo,content); //保存發(fā)送短信的內(nèi)容 ContentValuesvalues=newContentValues(); values.put("address",telNo);values.put("date",System.currentTimeMillis()); values.put("body",content); values.put("type",0);//0為發(fā)件箱信息 getContentResolver().insert(Uri.parse("content://sms/sent"),values);//界面跳轉(zhuǎn)MainActivity Intentintent=newIntent(); intent.setClass(SendMsg.this,MainActivity.class); startActivity(intent); } }); } privatevoidSendSMS(StringtelNo,Stringcontent){ SmsManagersms=SmsManager.getDefault(); //創(chuàng)建senTIntent參數(shù) IntentsentIntent=newIntent(SENT_SMS_ACTION); PendingIntentsentPI=PendingIntent.getBroadcast(SendMsg.this,0, sentIntent,0); //創(chuàng)建deliveredIntent參數(shù) IntentdeliveredIntent=newIntent(DELIVERED_SMS_ACTION); PendingIntentdelivePI=PendingIntent.getBroadcast(SendMsg.this, 0,deliveredIntent,0);//發(fā)送短信信息 sms.sendTextMessage(telNo,null,content,sentPI,delivePI); }}Recevie.javapublicclassReceiverextendsBroadcastReceiver{ privateStringtelNo; privateStringBuildermessageBody=newStringBuilder(); privatefinalStringSmsAction=privateContentResolverresolver; //@Override publicvoidonReceive(Contextcontext,Intentintent){ Stringaction=intent.getAction();//獲取短信 if(action.equals(SmsAction)){ Bundlebundle=intent.getExtras(); //遍歷短信 if(null!=bundle){ Object[]pdus=(Object[])bundle.get("pdus"); SmsMessage[]msg=newSmsMessage[pdus.length]; for(inti=0;i<pdus.length;i++){ msg[i]=SmsMessage.createFromPdu((byte[])pdus[i]); } for(SmsMessagecurrMsg:msg){ messageBody.append(currMsg.getDisplayMessageBody()); telNo=currMsg.getDisplayOriginatingAddress(); }//將短信存入數(shù)據(jù)庫(kù) addSmsToDB(telNo,messageBody.toString()); } } } //將短信添加到系統(tǒng)短信數(shù)據(jù)庫(kù)privatevoidaddSmsToDB(StringtelNo,Stringcontent){ ContentValuesvalues=newContentValues(); values.put("date",System.currentTimeMillis()); values.put("type",1);//1為收件箱信息 values.put("address",telNo); values.put("body",content); resolver.insert(Uri.parse("content://sms/"),values); }}之后為了實(shí)現(xiàn)收發(fā)和讀取功能必須在AndroidMainfest.xml中增加一些權(quán)限,代碼如下:<!--讀取短消息--><uses-permissionandroid:name="android.permission.READ_SMS"/><!--發(fā)送短消息--><uses-permissionandroid:name="android.permission.SEND_SMS"/><!--寫(xiě)入短消息--><uses-permissionandroid:name="android.permission.WRITE_SMS"/><!--接收消息--><uses-permissionandroid:name="android.permission.RECEIVE_SMS"/><!--讀取聯(lián)系人--><uses-permissionandroid:name="android.permission.READ_CONTACTS"/>同時(shí)注冊(cè)sendMsg.java的Activity:<activityandroid:name="com.message.SendMsg"></activity>3.3短信列表顯示和刪除功能的實(shí)現(xiàn)短信列表顯示界面主要根據(jù)聯(lián)系人顯示短信,每個(gè)聯(lián)系人占據(jù)一列,列中顯示與該聯(lián)系人最新的聯(lián)系信息。通過(guò)點(diǎn)擊列表項(xiàng)可查看與該聯(lián)系人的對(duì)話列表,通過(guò)長(zhǎng)按聯(lián)系人列表項(xiàng)可刪除該列。通過(guò)聯(lián)系人號(hào)碼將與同一聯(lián)系人的聯(lián)系信息從sms表中取出,再將數(shù)據(jù)庫(kù)信息放入List中,最后通過(guò)SimpleAdapter適配器將List適配進(jìn)布局listview中。從數(shù)據(jù)取出最近信息的代碼如下://獲得數(shù)據(jù)庫(kù)中的信息 publicList<Map<String,Object>>getData(){ //定義列表List存放取出的數(shù)據(jù) List<Map<String,Object>>list=newArrayList<Map<String,Object>>(); //從數(shù)據(jù)庫(kù)中取出數(shù)據(jù)并根據(jù)日期排列 CursorsmsCursor=getContentResolver().query( Uri.parse("content://sms/"),null,null,null,"datedesc"); //循環(huán)cursor數(shù)據(jù) while(smsCursor.moveToNext()){ //判斷cursor的數(shù)據(jù)在List中是否已有該聯(lián)系人的信息 booleanhas=false; for(inti=0;i<list.size();i++){ Map<String,Object>map1=list.get(i); Stringnum=(String)map1.get("address"); if(num.equals(smsCursor.getString(smsCursor .getColumnIndex("address")))){ has=true; break; } } //若List中未有聯(lián)系人的信息,則將該數(shù)據(jù)存入List中 if(!has){ //定義map存儲(chǔ)一列數(shù)據(jù) Map<String,Object>map=newHashMap<String,Object>(); //將數(shù)據(jù)庫(kù)中屬性為date的數(shù)據(jù)從long型轉(zhuǎn)化為yyyy-MM-ddHH:mm:ss格式 SimpleDateFormatsdf=newSimpleDateFormat( "yyyy-MM-ddHH:mm:ss"); //獲取并存儲(chǔ)數(shù)據(jù) Datedate=newDate(smsCursor.getLong(smsCursor .getColumnIndex("date"))); map.put("date",sdf.format(date)); inttype=smsCursor.getInt(smsCursor.getColumnIndex("type")); Stringbody=smsCursor.getString(smsCursor .getColumnIndex("body")); //判斷信息長(zhǎng)度是否大于20,若是區(qū)其前8字后加"...." if(body.length()>20){ body=body.substring(0,8); body=body+"...."; map.put("body",body); }else{ map.put("body",smsCursor.getString(smsCursor .getColumnIndex("body")));}Stringaddress=smsCursor.getString(smsCursor .getColumnIndex("address")); map.put("address",address); map.put("read", smsCursor.getInt(smsCursor.getColumnIndex("read"))); map.put("_id", smsCursor.getInt(smsCursor.getColumnIndex("_id"))); list.add(map); } } smsCursor.close(); returnlist; }之后將List通過(guò)適配器存入listview布局的代碼如下:SimpleAdaptersimplerAdapter=newSimpleAdapter(this,getData(), R.layout.listview,newString[]{"address","date","body"},newint[]{R.id.tvTelNo,R.id.tvDate,R.id.tvContent});msgList.setAdapter(simplerAdapter);長(zhǎng)按短信列表項(xiàng)顯示提示框和刪除短信的代碼如下:publicbooleanonItemLongClick(AdapterView<?>arg0,Viewarg1, intarg2,longarg3){ //TODOAuto-generatedmethodstub//顯示并設(shè)置提示框 AlertDialog.Builderad=newAlertDialog.Builder( MainActivity.this); TextViewtv=(TextView)arg1.findViewById(R.id.tvTelNo); finalStringtelNo=tv.getText().toString(); ad.setTitle(telNo); ad.setItems(newString[]{"刪除","取消"},//設(shè)置刪除和取消按鈕 newDialogInterface.OnClickListener(){ @Override publicvoidonClick(DialogInterfacedialog, intwhich){ //TODOAuto-generatedmethodstub switch(which){ case0://刪除短信 Uriuri=Uri.parse("content://sms/"); getContentResolver() .delete(uri,"address=?", newString[]{telNo}); break; case1://取消 break; default: break; }}}); ad.show(); returntrue; } });3.4短信對(duì)話框顯示功能的實(shí)現(xiàn)對(duì)話框界面能顯示用戶與聯(lián)系人的對(duì)話,下方可讓用戶發(fā)送短信。對(duì)話框界面通過(guò)intent從列表界面獲取聯(lián)系人號(hào)碼,通過(guò)查詢?cè)撎?hào)碼從表sms中獲取與該聯(lián)系人的所用現(xiàn)存信息,并以對(duì)話形式顯示。同時(shí)顯示對(duì)話效果,需要重寫(xiě)SimpleCursorAdapter的getVIew方法。在該方法中,通過(guò)判斷sms的屬性type,將用戶和聯(lián)系人的對(duì)話分別放在屏幕兩側(cè)。若type為1,則為聯(lián)系人發(fā)的短信,在左側(cè)顯示,type為0則為用戶所發(fā)信息。查詢并適配的語(yǔ)句如下:finalCursorc=getContentResolver().query(uri,projection, "address=?",newString[]{telNo},"dateASC");if(c.moveToFirst()){ @SuppressWarnings("deprecation") SimpleCursorAdapteradapter=newSimpleCursorAdapter(this, R.layout.listview1,c,newString[]{"address","date", "body"},newint[]{R.id.tvTelNo1,R.id.tvDate1, R.id.tvContent1}){ @Override//重寫(xiě)getVIew方法實(shí)現(xiàn)界面效果 publicViewgetView(intposition,ViewconvertView, ViewGroupparent){ Viewresult=super.getView(position,convertView,parent); intindex_type=c.getColumnIndex("type"); intindex_address=c.getColumnIndex("address"); intsms_type=c.getInt(index_type); Stringsms_phoneNmuber=c.getString(index_address); Viewcontainer=result.findViewById(R.id.show_msg); TextViewtelNo=(TextView)(result .findViewById(R.id.tvTelNo1)); LinearLayout.LayoutParamscontainerParameter=(LinearLayout.LayoutParams)(container .getLayoutParams());//通過(guò)判斷type類型,將短信放入界面左右兩側(cè) if(sms_type==1){ telNo.setText(sms_phoneNmuber); container.setBackgroundResource(R.drawable.left); containerParameter.gravity=Gravity.LEFT; }elseif(sms_type==2){ telNo.setText("我:"); container.setBackgroundResource(R.drawable.right); containerParameter.gravity=Gravity.RIGHT; } container.setLayoutParams(containerParameter); returnresult; } };3.5短信聯(lián)系人功能的實(shí)現(xiàn)再將從數(shù)據(jù)庫(kù)中讀取的信息寫(xiě)入界面時(shí),我們需要判斷該聯(lián)系人的信息是否在聯(lián)系人軟件中有存檔,若有,則需要將原本要顯示的聯(lián)系人號(hào)碼改為該聯(lián)系人姓名。獲取并判斷聯(lián)系人的代碼如下:Contact.javapublicclassContact{ publicContact(){} publicStringgetContactNameFromPhoneNum(Contextcontext,StringcontactInfo){StringcontactNames="";Uriuri=Uri.parse("content://com.android.contacts/phone_lookup/"+contactInfo);Cursorcursor=context.getContentResolver().query(uri,null,null,null,null);if(cursor.moveToFirst()){StringcontactName=cursor.getString(cursor.getColumnIndex("display_name"));cursor.close();if(contactNames=="")contactNames=contactName;elsecontactNames=contactNames+","+contactName;}returncontactNames; }}3.5文件傳送功能的實(shí)現(xiàn)3.6界面設(shè)置功能的實(shí)現(xiàn)第四章結(jié)語(yǔ)4.1總結(jié)4.2展望
您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!??!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!??!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝!?。
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供優(yōu)秀的畢業(yè)論文參考資料,請(qǐng)您刪除以下內(nèi)容,O(∩_∩)O謝謝?。?!A
national
survey
was
recently
launched
to
evaluate
the
eye
health
of
Chinese
children
andteenagers.On
June
6,
China's
annual
National
Day
for
Eye
Care,
the
China
Youth
Development
ServiceCenter
and
Zheji您好,為你提供
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 產(chǎn)品設(shè)計(jì)與開(kāi)發(fā)委托合同
- 生物學(xué)遺傳基因測(cè)試題庫(kù)及答案
- 公路運(yùn)輸合同基本知識(shí)
- 嵌入式系統(tǒng)的數(shù)據(jù)采集技術(shù)試題及答案
- 公路工程安全施工知識(shí)考點(diǎn)試題及答案
- 中國(guó)石拱橋的試題及答案
- 理解數(shù)據(jù)處理的時(shí)間復(fù)雜度試題及答案
- 2025年礦山無(wú)人作業(yè)技術(shù)智能化安全防護(hù)技術(shù)研究報(bào)告
- 合同簽字協(xié)議書(shū)范本圖片
- 工業(yè)互聯(lián)網(wǎng)平臺(tái)數(shù)據(jù)庫(kù)融合技術(shù)2025年技術(shù)創(chuàng)新與產(chǎn)業(yè)應(yīng)用對(duì)接報(bào)告
- 2025-2030中國(guó)軍用無(wú)人機(jī)行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025年中國(guó)工裝治具市場(chǎng)調(diào)查研究報(bào)告
- 收購(gòu)爛尾樓可行性研究報(bào)告
- 2025年國(guó)際貿(mào)易實(shí)務(wù)課程考試試題及答案
- 爆炸事故賠償協(xié)議書(shū)
- 2025華陽(yáng)新材料科技集團(tuán)有限公司招聘(500人)筆試參考題庫(kù)附帶答案詳解
- 2025年下半年度蘇州城際鐵路限公司管理崗位公開(kāi)招聘易考易錯(cuò)模擬試題(共500題)試卷后附參考答案
- 聚合物化學(xué)基礎(chǔ)試題及答案
- GB/T 12008.7-2025塑料聚氨酯生產(chǎn)用聚醚多元醇第7部分:堿性物質(zhì)含量的測(cè)定
- 蔬菜凈菜車間管理制度
- 2025年中國(guó)石油化工行業(yè)市場(chǎng)發(fā)展前景及發(fā)展趨勢(shì)與投資戰(zhàn)略研究報(bào)告
評(píng)論
0/150
提交評(píng)論