安卓:从ContactsProvider检索图像或缩略图的API级别10 [英] Android:Retrieving Image or Thumbnail from ContactsProvider for API level 10

查看:253
本文介绍了安卓:从ContactsProvider检索图像或缩略图的API级别10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Android ContactsProvider retreive全尺寸接触式图像的API级别10以上。

I would like to retreive the full size Contact Image from the Android ContactsProvider for API level 10 and above.

从我的理解是没有办法测试我是否可以得到使用PHOTO_URI(API等级11),全尺寸的照片,这似乎是既填充使用PHOTO_FILE_ID(API等级14)。然后有PHOTO_ID(API级别5)这可能抱到照片或不是一个参考,如果不退回到PHOTO_URI或PHOTO_THUMBNAIL_URI(API等级11)。我使用2.3.3(API 10级)。这是所有的混乱和困惑。

From my understanding there is no way to test whether I get the full size photo using PHOTO_URI(API level 11) which seems to be populated either using the PHOTO_FILE_ID(API level 14).Then there is PHOTO_ID(API level 5) which could hold a reference to the photo or not,if not fallback to PHOTO_URI or PHOTO_THUMBNAIL_URI(API level 11).I use 2.3.3(API level 10).This is all confusing and perplexing.

我用DISPLAY_PHOTO(API等级14),它是gauranteed给我下面的ICS(还没有尚未测试)。

I use DISPLAY_PHOTO(API level 14),it is gauranteed to give me a null value or crash below ICS(havent tested yet).

我也明白,某些图片说,与ContactsProvider不能retreived同步,并且只使用了Android ContactsProvider的,这意味着用户可以看到在手机的通讯录应用图像的第三方应用程序,但不是在我的应用程序。

I also understand that some images from say 3rd party applications that sync with ContactsProvider cannot be retreived and are only for the use of the Android ContactsProvider which means that the user sees the image in the Contacts app of the phone but not in the my app.

您可能知道的任何解决方案都可以帮助我总是retreive全尺寸的API,而不是缩略图API级别10以上?

Any solution you might know of that could help me always retreive the full size api and not the thumbnail for API level 10 and above?

我ATLEAST能否retreive联系人的API级别10的缩略图?

Can I atleast retreive the thumbnail of the Contact for API level 10?

推荐答案

我发现这个职位,获得了API级别5缩略图及以上使用ContactsContract API工作的方法,检查的这里了解更多信息:

I found a method on this post that works for obtaining the thumbnail for API levels 5 and above using the ContactsContract API,check here for more information:

    public static Bitmap loadContactPhoto(ContentResolver cr, long id) {
Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id);
InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);
if (input == null) {
     return getBitmapFromURL("http://thinkandroid.wordpress.com");
 }
return BitmapFactory.decodeStream(input);
} 

这篇关于安卓:从ContactsProvider检索图像或缩略图的API级别10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆