android 中管理短信

android 从SMS获取联系人信息

Thomas posted @ Jul 01, 2011 06:21:55 AM in Programme with tags Android , 4758 阅读

 在SMS数据库中person这个值得到的有人说就是联系人的ID但是实际上这个值是不稳定的,这里要得到联系人信息需要通过address获得的发件人电话号码和ContactsContract.PhoneLookup.CONTENT_FILTER_URI来实现.代码如下

ContactItem getContactByAddr(Context context, final SMSItem sms) { 
    Uri personUri = Uri.withAppendedPath( 
            ContactsContract.PhoneLookup.CONTENT_FILTER_URI, sms.mAddress); 
    Cursor cur = context.getContentResolver().query(personUri, 
            new String[] { PhoneLookup.DISPLAY_NAME }, 
            null, null, null ); 
    if( cur.moveToFirst() ) { 
        int nameIdx = cur.getColumnIndex(PhoneLookup.DISPLAY_NAME); 
        ContactItem item = new ContactItem(); 
        item.mName = cur.getString(nameIdx); 
       cur.close(); 
       return item; 
   } 
   return null; 
}
本文为原创转载请注明微笑 Creative Commons License
转载时请遵循 “署名-非商业用途-保持一致” 的创作共用协议
AP SSC sa 2 Model Pa 说:
2022年9月08日 08:40

SA-2 Exams called Summative Assignment-2 exams are known as Annual final public exams, every year those exams are held at the end of the academic session as Term-2 exams. Every State Board Telugu Medium, AP SSC sa 2 Model Paper English Medium & Urdu Medium Students can download the AP 10th Class SA 2 Model Paper 2023 Pdf with Answer Solutions designed by the Board based on the revised syllabus and curriculum.Class teachers and others have designed and suggested the AP 10th Class SA 2 Model Paper 2023 for all languages and subjects of the course for theory, objective,

mein ebay zusammenfa 说:
2023年7月20日 04:42

Auf der Seite „Meine eBay-Zusammenfassung“ werden Informationen zu fast allen Bereichen Ihres eBay-Alltags angezeigt, z. B. Ihre Einkaufshistorie, eine Liste Ihrer zuletzt gesehenen Artikel, der Status Ihrer Anfragen und Angebote für Artikel im Ausverkauf, mein ebay zusammenfassung eine Übersicht über Ihre Einkaufshistorie, die Artikel, die Sie beobachten, sowie die Verkäufer und Looks, die Sie gespeichert haben. Ihre eBay-Startseite verfügt außerdem oben auf der Seite über drei separate Abschnitte, die den eBay-Aktivitäten, Nachrichten und dem Konto folgen.

Jharkhand 7th Model 说:
2023年9月13日 20:28

State Council of Educational Research and Training (SCERT) Jharkhand has Going to Conducted High School Aunval Exam 2024, SCERT Jharkhand which is Mainly Responsible for Conducting Exam Every year, This SCERT Jharkhand 7th Exam Very Year More Than 25 Laks of Students Attended, SCERT Jharkhand is Administered by the State Government of Jharkhand and Thrives to Improve the Quality of Jharkhand 7th Model Paper 2024 Education in the state.SCERT Jharkhand is also Responsible for Prescribing the SCERT Jharkhand Model Paper 2024 for the Students Studying in the Jharkhand Affiliated Schools, Jharkhand Question Paper 2024 Designed by Senior Experts Study Materiel help the Students to get an idea about the Final Exam 2024.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter