java - Changing contact image programmically is working for some devices and not for others -


I'm trying by updating your contacts picture Contact ID, but when I tested the code on a Samsung S3 It is implemented properly but no changes have been made on the device. This works perfectly on my Nexus 4, does anyone know what's going on. This is my code:

  public void setContactImage (bitmap img, string contactUriId, string rawID) {ArrayList & LT; ContentProviderOperation & gt; Ops = new arreelist & lt; Content provider operation & gt; (); Try {bitmap bitmap = scaleDownBitmap (img, 500, getApplicationContext ()); Bytereon output stream image = new byteOnputstream (); Bitmap.compress (bitmap.compressformat.jpeg, 100, image); ContentProviderOperation.Builder contentOp = ContentProviderOperation.newUpdate (ContactsContract.Data.CONTENT_URI); contentOp.withSelection (ContactsContract.Data.CONTACT_ID + "=?" + "and" + ContactsContract.Data.MIMETYPE + "=?", new String [] {String.valueOf (contactUriId), ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE} ); ContentOp.withValue (ContactsContract.CommonDataKinds.Photo.PHOTO, image.toByteArray ()); Ops.add (contentOp.build ()); } Hold (exception e) {e.printStackTrace (); } Try {GetContentResolver (). ApplyBatch (ContactsContract.AUTHORITY, ops); } Hold (exception e) {e.printStackTrace (); }}  

Bamp

I think you are writing It is better to photograph the raw contact display photo and mark it as primary and super primary.

Mark as IS_PRIMARY and IS_SUPER_PRIMARY data line


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -