我已检索到 android 手机联系人图像并将其存储在 arraylist 中,如下所示。
id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
String photoWhere = ContactsContract.Data.CONTACT_ID + " = ? AND " +ContactsContract.Data.MIMETYPE + " = ?";
String[] photoParams = new String[] {id,ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE};
Cursor photoCursor = contentResolver.query(ContactsContract.Data.CONTENT_URI, null, photoWhere, photoParams, null);
if(photoCursor!=null && photoCursor.getCount()>0)
{
while(photoCursor.moveToNext())
{
byte[] contactPhoto = photoCursor.getBlob(photoCursor.getColumnIndex(ContactsContract.CommonDataKinds.Photo.PHOTO));
if(contactPhoto!=null)
{
mContactImage="data:image/jpeg;base64," + Base64.encodeToString(contactPhoto, Base64.NO_WRAP);
sContactImageArray.add(mContactImage);
}
}
}
photoCursor.close();
然后我将这个 base64 字符串传递给 javascript 并显示为图像。但是图像分辨率很差。这与存储在电话联系人中的图像不同。如何检索具有 100% 质量的联系人图像。?