tags:

views:

51

answers:

0

this method can update photo to my android emulator but could not sync to gmail contacts, I think this method is not correct, who can tell me how to do that? I think android photo could not be sync to gmail contact, is this thinking correct? this is my code:

Bitmap photo = getMyPhoto();
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
photo.compress(Bitmap.CompressFormat.PNG, 100, baos);
ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI).withValue(Data.RAW_CONTACT_ID, rawId).withValue(Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE).withValue(ContactsContract.CommonDataKinds.Photo.PHOTO, baos.toByteArray()).build());