2014-03-13 42 views
1

接触我尝试使用下面的代码来从我接触到更大尺寸的画面:大图版本针对Android

Uri my_contact_Uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long.parseLong(contactId)); 

     InputStream photo_stream = ContactsContract.Contacts.openContactPhotoInputStream(getContentResolver(), my_contact_Uri); 

    if(photo_stream != null) 
    { 
     BufferedInputStream buf =new BufferedInputStream(photo_stream); 
     Bitmap my_btmp = BitmapFactory.decodeStream(buf); 
     profile.setImageBitmap(my_btmp); 
    } 
    else 
    { 
     profile.setImageResource(R.drawable.contactpic); 
    } 

我有一个imageviewmatch_parent(宽度和高度)。

来自联系人的所有照片都模糊不清。我确定它正在缩略图。我如何获得大图片?

回答

1

你必须使用

ContentResolver cr = getContext().getContentResolver(); 
Uri contactUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long.valueOf(CONTACT_ID)); 
InputStream photo_stream = ContactsContract.Contacts.openContactPhotoInputStream(cr, contactUri, true); 

如果不输入布尔参数,它默认为false,它将返回缩略图视图。

+0

谢谢!有效.. – TheDevMan