Android Get Contact Picture from Call Log

后端 未结 5 1153
南笙
南笙 2020-12-18 13:07

It was pretty easy to get the Contact picture when querying the People.CONTENT_URI, with a simple

People.loadContactPhoto(activity, ContentUr         


        
5条回答
  •  醉梦人生
    2020-12-18 13:41

    I'm doing it in this way:

    ContentResolver cr=this.getContentResolver();
    Cursor cc = cr.query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null);
    while (cc.moveToNext())
    {
        contactId = cc.getString(cc.getColumnIndex(ContactsContract.Contacts._ID));
        Uri contactPhotoUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long.parseLong(contactId));
        InputStream is=ContactsContract.Contacts.openContactPhotoInputStream(cr, contactPhotoUri);
        //blah-blah
    }
    

提交回复
热议问题