title: take a single picture
body: <p>there is a simple tutorial to take a picture with android (http://developer.android.com/guide/topics/media/camera.html) which I followed.</p>
  
  <pre><code>private static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 100;
  protected void onTakePicture()
  {
      // create Intent to take a picture and return control to the calling application    
      Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);    
      // create a file to save the image    
      File file = Environment.getExternalStorageDirectory();
      String path = file.getAbsolutePath() + "/Android/data/com.myapplication/files";
      File dir = new File(path);
      if (!dir.isDirectory())
          dir.mkdirs();
      File outFile = new File(path + File.separator + "img.jpg");
      Uri fileUri = Uri.fromFile(outFile);
      intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); 
      // set the image file name    
      // start the image capture Intent
      startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);        
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data)
  {
      if (requestCode==CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE)
      {
           // Image captured and saved to fileUri specified in the Intent
          Uri fn = data.getData();
          Toast.makeText(this, "Image saved to:\n" + fn.toString(), Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p>I am calling this from within an activity. The problem now is that when the camera activity appears, I can take multiple pictures, but I only want to take a single picture and then return to the calling activity. onActivityResult will not be called until I leave the camera activity (by pressing the "back" button). Then the data.getData() crashes.</p>
  
  <p>Any ideas?</p>
  
  <p>Thank you
  Gerhard</p>