title: Cancel from Android Camera capture screen return to home page
body: <p>I got a problem to capture photo from camera. After I pressing the "Cancel" or "Confirm" button, it will return to Home page instead of the Activity which start the camera. Here is my code:</p>
  
  <pre><code>Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);                            
  startActivityForResult(intent, TAKE_PICTURE_REQUEST);
  </code></pre>
  
  <p>What could be wrong in my code? Thanks</p>
  
  <p><strong>Edit 1:</strong></p>
  
  <p>This is my code for the button click listener:</p>
  
  <pre><code>DialogInterface.OnClickListener m_dialogOnclick = new DialogInterface.OnClickListener(){
  
      @Override
      public void onClick(DialogInterface dialog, int which) {
  
          switch (which) {
              case 0:
                  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);                            
                  startActivityForResult(intent, TAKE_PICTURE_REQUEST);
                  break;
  
              case 1:
                  break;
              case 2:
                  break;
              case 3:
                  break;
          }
      }
  };
  </code></pre>
  
  <p>And the permission:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-feature android:name="android.hardware.camera" android:required="true" /&gt;
  </code></pre>