title: android: save capture photo 0kb in the folder
body: <p>after taking a photo, my photo display in activity, but when i check into folder, the size from my photo is 0kb, i have no idea why this happen, and when i take a photo again, the new photo not save in the folder that i wanted, this is my code :</p>
  
  <pre><code> {
  
  
                      File sdCard= Environment.getExternalStorageDirectory();
              File path = new File (sdCard.getAbsolutePath() + "/android/data/spaj_foto");
              path.mkdir();
              File file= new File (path,"spaj_foto.png");          
               outputFileUri = Uri.fromFile(file); 
                Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 
                cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri  );
                startActivityForResult(cameraIntent,TAKE_PHOTO_CODE ); 
  
                  }
  
  @Override
          protected void onActivityResult(int requestCode, int resultCode, Intent data) {
              super.onActivityResult(requestCode, resultCode, data);
  
              if (resultCode == RESULT_OK) {
                   if (requestCode == TAKE_PHOTO_CODE) {
                  Bundle extras = data.getExtras();
  
                  Bitmap photo = (Bitmap) extras.get("data"); 
                  image_spaj.setImageBitmap(photo);
              }
              else if (resultCode == RESULT_CANCELED) {
                  Toast.makeText(this, "Picture was not taken", Toast.LENGTH_SHORT);
                 } 
              }
  
  
          }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>this is my logcat :</p>
  
  <pre><code>    09-26 17:57:38.072: E/AndroidRuntime(12498): FATAL EXCEPTION: main
  09-26 17:57:38.072: E/AndroidRuntime(12498): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity {org.example.touch/org.example.touch.FormSpaj}: java.lang.NullPointerException
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3179)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3222)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at android.app.ActivityThread.access$1100(ActivityThread.java:140)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at android.os.Handler.dispatchMessage(Handler.java:99)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at android.os.Looper.loop(Looper.java:137)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at android.app.ActivityThread.main(ActivityThread.java:4895)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at java.lang.reflect.Method.invokeNative(Native Method)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at java.lang.reflect.Method.invoke(Method.java:511)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at dalvik.system.NativeStart.main(Native Method)
  09-26 17:57:38.072: E/AndroidRuntime(12498): Caused by: java.lang.NullPointerException
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at org.example.touch.FormSpaj.onActivityResult(FormSpaj.java:990)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at android.app.Activity.dispatchActivityResult(Activity.java:5347)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3175)
  09-26 17:57:38.072: E/AndroidRuntime(12498):    ... 11 more
  </code></pre>