title: Adding picture to android phone contact
body: <p>How we could add picture in android contact. I am able to save name, email_id, address. I have tried enough to save picture to android contact.</p>
  
  <p>I am saving name like this :</p>
  
  <pre><code>  ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
              .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
              .withValue(ContactsContract.Data.MIMETYPE,ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
              .withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, name).build());
  </code></pre>
  
  <p>For saving picture :</p>
  
  <pre><code>  File wallpaperDirectory = new File("/"+Environment.getExternalStorageDirectory().getAbsolutePath()+"/DCIM/Deja_Images/");
      // have the object build the directory structure, if needed.
      wallpaperDirectory.mkdirs();
      String extStore= wallpaperDirectory+"/barcode.PNG";
  
      BitmapFactory.Options options = new BitmapFactory.Options();
      options.inPreferredConfig = Bitmap.Config.ARGB_8888;
      Bitmap bitmap = BitmapFactory.decodeFile(extStore, options);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
  
      bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); //bm is the bitmap object   
       byte[] b = baos.toByteArray(); 
      ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
              .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
              .withValue(ContactsContract.Data.MIMETYPE,ContactsContract.CommonDataKinds.Photo.PHOTO)
              //.withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, name)
              .withValue(ContactsContract.CommonDataKinds.Photo.PHOTO,b).build());
  </code></pre>
  
  <p>Please let me know where i am missing something, or m doing in wrong way.</p>
  
  <p>Thanks.</p>