开发者

Android Contacts Access

Uri contactUri = ContactsContract.Contacts.CONTENT_URI;
        String[] PROJECTION = new String[] 
        {
           Contacts._ID,
           Contacts.DISPLAY_NAME,
           Contacts.HAS_PHONE_NUMBER,
        };
        String SELECTION = ContactsContract.Contacts.HAS_PHONE_NUMBER + "='1'";
    Cursor contacts = getContentResolver().query(contactUri, PROJECTION, null, null, null);

here is a piece of code when i comment out last line it works and when i use it it gives the message the process (package name) is stopped unexpectedly. u use permi开发者_JAVA技巧ssion of reading contacts in mainifiest file.


Sorry the question is not clear . Yes you have to include the following permissions to read the contacts .

  <uses-permission android:name="android.permission.READ_CONTACTS"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜