我需要我的联系人的联系人图像作为位图。
I need the contact images of my contacts as bitmaps.
我发现这个code:
Uri my_contact_Uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(id));
InputStream photo_stream = ContactsContract.Contacts.openContactPhotoInputStream(cr, my_contact_Uri, true);
BufferedInputStream buf = new BufferedInputStream(photo_stream);
Bitmap my_btmp = BitmapFactory.decodeStream(buf);
buf.close();
return my_btmp;
其中工程pretty的很好,但功能openContactPhotoInputStream(CR,my_contact_Uri,真)仅适用于API 14+。 openContactPhotoInputStream(CR,my_contact_Uri)的作品也较早版本,但没有第三个参数,它似乎只检索缩略图。
which works pretty well, but the function openContactPhotoInputStream(cr, my_contact_Uri, true) is only available on API 14+. openContactPhotoInputStream(cr, my_contact_Uri) works also on earlier versions, but without the 3rd parameter it seems to retrieve only the thumbnail.
在文档这样说的:
See Also
if instead of the thumbnail the high-res picture is preferred
但本说明后面的链接似乎导致当前页面上再次
but the link behind this note seems to lead on the current page again
我能得到的图像的URI,但什么呢?
I could get the uri of the image, but what then?
道理很简单:没有低于14 API高分辨率联系人图片。 您需要使用低分辨率较低API或设置分-SDK至14。
It's simple: there is not high res contact picture below API 14. You need to use the low res on lower APIs or set min-sdk to 14.
据中添加了14 API和较低的API将永远不会有你手工创建的开放的我们背后什么。
It was added in API 14 and lower APIs will never have anything behind the Uri you created by hand.