title: Getting nullPointerException with contentprovideroperation
body: <p>I'm trying for updating a contact photo in android through code. Using content Provider Operation I've tried to update the photo. Update query's added in code snippet. But nothing happens. My code snippet is below.</p>
  
  <pre><code>   @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      // TODO Auto-generated method stub
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == 1 &amp;&amp; data != null)
  
      {
  
          Uri contactData = data.getData();
  
          String[] projection = new String[] { Data.RAW_CONTACT_ID,
                  Photo.PHOTO };
  
          Cursor c = getContentResolver().query(Data.CONTENT_URI, projection,
                  null, null, null);
  
          if (c.moveToFirst()) {
  
              String dataid = c.getString(c
                      .getColumnIndex(Data.RAW_CONTACT_ID));
              String first = String.valueOf(dataid);
  
              byte[] dataid1 = c.getBlob(c.getColumnIndex(Photo.PHOTO));
              String first1 = String.valueOf(dataid1);
              System.out.println("fisttry");
              System.out.println(dataid);
              System.out.println(first);
              System.out.println(first1);
              System.out.println(dataid1);
  
              try {
  
                  System.out.println("fisttry");
                  ArrayList&lt;ContentProviderOperation&gt; ops = new ArrayList&lt;ContentProviderOperation&gt;();
  
                  ContentProviderOperation.Builder op = ContentProviderOperation
                          .newUpdate(ContactsContract.Data.CONTENT_URI);
  
                  op.withSelection(
                          ContactsContract.Data.RAW_CONTACT_ID + "=?"
                                  + " AND " + ContactsContract.Data.MIMETYPE
                                  + "=?",
                          new String[] {
                                  String.valueOf(dataid),
                                  ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE });
                  op.withValue(
                          ContactsContract.Data.MIMETYPE,
                          ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE);
                  op.withValue(ContactsContract.CommonDataKinds.Photo.PHOTO,
                          photo);
  
                  ops.add(op.build());
                  System.out.println(op);
                  System.out.println(ops);
              } catch (Exception e) {
                  e.printStackTrace();
              }
  
              // Update
  
              try {
                  this.getContentResolver().applyBatch(
                          ContactsContract.AUTHORITY, ops);
                  System.out.println("secondtry");
              } catch (RemoteException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (OperationApplicationException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
  
          }
      }
  
  
  
  }
  </code></pre>
  
  <p>Stacktrace:    </p>
  
  <pre><code>01-12 01:19:22.202: E/AndroidRuntime(16057): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://com.android.contacts/contacts/lookup/0r69-303A36303A365A/71 (has extras) }} to activity {com.ileaf.camerafun/com.ileaf.camerafun.TrialActivity}: java.lang.NullPointerException
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3521)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3563)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.app.ActivityThread.access$2800(ActivityThread.java:126)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2068)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.os.Handler.dispatchMessage(Handler.java:99)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.os.Looper.loop(Looper.java:123)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.app.ActivityThread.main(ActivityThread.java:4633)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at java.lang.reflect.Method.invoke(Method.java:521)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at dalvik.system.NativeStart.main(Native Method)
  01-12 01:19:22.202: E/AndroidRuntime(16057): Caused by: java.lang.NullPointerException
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.content.ContentProviderProxy.applyBatch(ContentProviderNative.java:454)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:95)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.content.ContentResolver.applyBatch(ContentResolver.java:622)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at com.ileaf.camerafun.TrialActivity.onActivityResult(TrialActivity.java:513)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.app.Activity.dispatchActivityResult(Activity.java:3890)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3517)
  01-12 01:19:22.202: E/AndroidRuntime(16057):    ... 11 more
  </code></pre>