ContactsContract.Contacts:

Constants for the contacts table, which contains a record per aggregate of raw contacts representing the same person   常量的联系人表,其中包含一个记录每个联系人表示同一个人的集合。
 
ContactsContract.CommonDataKinds:
Container for definitions of common data types stored in the ContactsContract.Data table. 
容器数据类型定义的常见存储在ContactsContract.Data表。
 
ContactsContract.CommonDataKinds.Phone:
A data kind representing a telephone number. 一个数据类型代表一个电话号码。
 
ContactsContract.CommonDataKinds.Phone.CONTENT_URI
The content:// style URI for all data records of the CONTENT_ITEM_TYPE MIME type, combined with the associated raw contact and aggregate contact data.
内容:/ /风格URI对于所有数据记录的内容项类型的MIME类型,结合相关的原始联系人和集合联系人数据。
 
ContactsContract.CommonDataKinds.Phone.NUMBER
The phone number as the user entered it. 电话号码。
 
 
 
以上内容是SDK上的内容,翻译的不完全。但是都可以取得联系人号码,姓名等等。
 
 
import android.provider.Contacts;在Contacts上划了横线,所以应该是sdk已经取消的用法。
所以以下取联系人资料的用法是有问题的。
String[] projection = new String[]{
    Contacts.People._ID,
    Contacts.People.NAME,
    Contacts.People.NUMBER
   
    };
   
    cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
    projection, 
    Contacts.People.NUMBER + "=" +incomingNumber, 
    null, 
    null);
 
import android.provider.ContactsContract;是存在的,所以应该用ContacContract来取资料。
 
String[] projection = new String[]{
    ContactsContract.Contacts._ID,
    ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,//可以换为ContactsContract.Contacts.DISPLAY_NAME
    ContactsContract.CommonDataKinds.Phone.NUMBER//取电话号码是唯一的。
   
    };
   
    cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
    projection, 
    ContactsContract.CommonDataKinds.Phone.NUMBER + "=" +incomingNumber, 
    null, 
    null);
    if(cursor.getCount()==0){
    mTextView.setText("unknown number");
    }else if(cursor.getCount()>0){
cursor.moveToFirst();
//在projection这个数组里名字是放在第1个位置
// String name = cursor.getString(1);
String name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
mTextView.setText(name+":"+incomingNumber);
}
 
 
别忘了权限。<uses-permission android:name="android.permission.READ_CONTACTS"/> 
涉及的代码为:EX06_06.