android - How to update a contact picture it has no picture -
it asked 1 no answers yet.how update picture of contact has no picture. code is.
if(check_image == null) { bitmap bmimage = bitmapfactory.decodefile(picturepath); bytearrayoutputstream baos = new bytearrayoutputstream(); bmimage.compress(bitmap.compressformat.jpeg, 80, baos); byte[] b = baos.tobytearray(); toast.maketext(getapplicationcontext(), "if", toast.length_long).show(); ops.add(contentprovideroperation .newinsert( contactscontract.data.content_uri) .withvaluebackreference( contactscontract.data.raw_contact_id, 0) .withvalue( contactscontract.data.mimetype, contactscontract.commondatakinds.photo.content_item_type) .withvalue( contactscontract.commondatakinds.photo.data15, b).build()); } else { toast.maketext(getapplicationcontext(), "else", toast.length_long).show(); ops.add(contentprovideroperation .newupdate(contactscontract.data.content_uri) .withselection( contactscontract.data.contact_id + " = ? , " + contactscontract.data.mimetype + " = ?", new string[] { contactid, contactscontract.commondatakinds.photo.content_item_type }) .withvalue(photo.data15, image_byte).build()); }
Comments
Post a Comment