title: Trouble with adding file path to the MediaStore.ACTION_IMAGE_CAPTURE intent
body: <p>I am adding a photo from the phones camera to a Fragment. I am including the file path to where I would like the pic to get saved in the camera intent(<code>MediaStore.ACTION_IMAGE_CAPTURE</code>). </p>
  
  <p>My problem is that after launching the camera and taking the pic the I am not able to get back to my app. The screen stays in the part where the user gets the option to accept the pic or take another one. The phone doesn't hang or crash and I am able to get back to my app by hitting the back button, but when I get back to the app it is without the pic. </p>
  
  <p>I hope I have made my problem clear, if not let me know and I will try to explain better. I have attached (what I think) are the relevant bits of code.Let me know if you need to see anymore of the code. </p>
  
  <p>Launching the camera intent:</p>
  
  <pre><code>void takePic()
  {
    if(isExternalStorageWritable() &amp;&amp; isExternalStorageReadable()) 
    {
        Log.w("Rakshak", "in the take pic");
  
        File file = getPicStoragePath();
  
        Uri uriSavedImage=Uri.fromFile(file);
  
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
        startActivityForResult(intent, CAMERA_IMAGE_ACTIVITY_REQUEST_CODE);
    }
   }
  
  public File getPicStoragePath() {
  
       Log.w("Rakshak", "in the get pic file");
       File root = android.os.Environment.getExternalStorageDirectory();
       File dir = new File (root.getAbsolutePath() + File.separator +"YAN");
       if(!dir.exists())
           dir.mkdirs();
       File file = new File(dir,getPicName());
       return file;
      }
  
   public String getPicName()
   {
       Log.w("Rakshak", "in the get pic name");
  
       if(title.getText().toString().trim().length() == 0)
       {
           Log.w("Rakshak", "no title");
           Calendar cal=Calendar.getInstance();//get an instance of the calendar 
           return String.format("%1$te %1$tB %1$tY,%1$tI:%1$tM:%1$tS %1$Tp",cal);// get the data/time when the note was created
       }
       else 
       {
           return title.getText().toString().trim();
       }   
   }
  </code></pre>
  
  <p>I have these permissions in the manifest: </p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  </code></pre>
  
  <p>The relavent bits from the onActivityResult:</p>
  
  <pre><code>case CAMERA_IMAGE_ACTIVITY_REQUEST_CODE:
                Log.w("Rakshak", "in the camera case");
               myBitmap = data.getExtras().getParcelable("data");                      
               photo.setVisibility(View.VISIBLE);
               photo.setImageBitmap(myBitmap);
               update_pic = true;
               return;
  </code></pre>
  
  <p>There are no error messages in the LogCat. And I could not find anything of note in there. </p>
  
  <p>I get the pic inserted onto the image view just fine if I dont add a file path to the camera intent. It is only when I add the file path that the stays in the "accept pic" bit of the camera.</p>