title: capture photo using front camera
body: <p>I am following this link <a href="http://www.vogella.com/articles/AndroidCamera/article.html#tutorial_cameraapi" rel="nofollow">http://www.vogella.com/articles/AndroidCamera/article.html#tutorial_cameraapi</a></p>
  
  <p>only I changed <strong>cameraId = findFrontFacingCamera();</strong> line to <strong>cameraId = findBackFacingCamera();</strong></p>
  
  <p>and write the method like this:</p>
  
  <pre><code>  private int findBackFacingCamera() {
      int cameraId = -1;
      // Search for the back facing camera
      int numberOfCameras = Camera.getNumberOfCameras();
      for (int i = 0; i &lt; numberOfCameras; i++) {
        CameraInfo info = new CameraInfo();
        Camera.getCameraInfo(i, info);
        if (info.facing == CameraInfo.CAMERA_FACING_BACK) {
          Log.d(DEBUG_TAG, "back Camera found");
          cameraId = i;
          break;
        }
      }
      return cameraId;
    }
  </code></pre>
  
  <p>And I modify this line <strong>camera.takePicture(null, null, new PhotoHandler(getApplicationContext()));</strong></p>
  
  <p>to</p>
  
  <pre><code>try {
          camera.takePicture(null, null, new PhotoHandler(getApplicationContext()));
      } catch (Throwable e) {
          Log.d("error",""+e);
      }
  </code></pre>
  
  <p><strong>I HAD CHANGED NOTHING</strong></p>
  
  <p><strong>Device I am checking on Galaxy Fit</strong></p>
  
  <p><strong>Giving error</strong></p>
  
  <pre><code>07-05 07:09:06.159: D/error(26994): java.lang.NullPointerException
  </code></pre>