title: Phonegap Capture not working for jelly bean
body: <p>I am facing issue regarding Phonegap Capture image function. Though this question has been asked many times before, but I found no solution. So I'm asking here again.
  I am trying to capture an Image and set it in my HTML page using phonegap.
  Here is my code:</p>
  
  <pre><code>function captureImage() {
  navigator.device.capture.captureImage(captureSuccess, captureError, {limit: 1,
  quality:100,
  correctOrientation: true,
  destinationType : Camera.DestinationType.FILE_URI, 
  targetWidth: 800,
  targetHeight: 800,
  saveToPhotoAlbum: true });
  }
  
  function captureSuccess(mediaFiles) {
  var i, len;
  for (i = 0, len = mediaFiles.length; i &lt; len; i += 1) {
  uploadFile(mediaFiles[i]);
         }       
  }
  
  function captureError(error) {
  var msg = 'An error occurred during capture: ' + error.code;
  $("#errorNot1").fadeIn();
  $("#errorMsg").text("Unable to capture image.");
  }
  
  function uploadFile(mediaFile) {
  $(".contentdiv").css("display","none");
  $("#takePhoto").css("display","block");
  $("#fromLib").css("display","none");
  path = mediaFile.fullPath,
  name = mediaFile.name;
  $('.largeImage').attr("src",path);
  }
  </code></pre>
  
  <p>The problem is, its starting camera and capturing image. But when trying to set in HTML page, the app is crashing.</p>
  
  <p>Here is my logcat output (My sdk is not updated and I'm trying to test the app with Android 4.1.1, so the logcat output might not be up to the mark):</p>
  
  <pre><code>??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;): FATAL EXCEPTION: main
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;): java.lang.RuntimeException: Unable to resume activity {com.infy.qure/com.infy.qure.AndroidQuREActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {com.infy.qure/com.infy.qure.AndroidQuREActivity}: java.lang.NullPointerException
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2616)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2644)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2130)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.ActivityThread.access$600(ActivityThread.java:140)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.os.Handler.dispatchMessage(Handler.java:99)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.os.Looper.loop(Looper.java:137)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.ActivityThread.main(ActivityThread.java:4898)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at java.lang.reflect.Method.invokeNative(Native Method)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at java.lang.reflect.Method.invoke(Method.java:511)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at dalvik.system.NativeStart.main(Native Method)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {com.infy.qure/com.infy.qure.AndroidQuREActivity}: java.lang.NullPointerException
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3182)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2603)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     ... 12 more
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;): Caused by: java.lang.NullPointerException
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at org.apache.cordova.DroidGap.onActivityResult(DroidGap.java:850)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.Activity.dispatchActivityResult(Activity.java:5368)
  ??-?? ??:??:??.???: INFO/&lt;unknown&gt;(&lt;unknown&gt;):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3178)
  </code></pre>
  
  <p>I have tried all these solutions provided:</p>
  
  <p><a href="https://stackoverflow.com/questions/13068764/phonegap-application-crash-taking-portrait-picture">PhoneGap: Application crash taking portrait picture</a></p>
  
  <p><a href="https://stackoverflow.com/questions/13171435/code-not-working-in-jelly-beans">code not working in Jelly Beans</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11470442/phonegapandroid-4-app-sometimes-crashes-when-taking-picture-from-photolibrary">Phonegap|Android 4 - App sometimes crashes when taking picture from PHOTOLIBRARY</a></p>
  
  <p>But all these of no help.
  Same issue I'm facing while trying to get the image from photolibrary and setting in HTML.</p>
  
  <p>The main thing I want to mention here is that, the above code is working fine with Samsung Galaxy sIII (Android 4.0.4) but not working in Galaxy sIII (Android 4.1.1).
  What might be the problem? Am I doing any mistake? Any input will be helpful.</p>