title: Camera image is not saving in sdcard and does not display in imageview in front camera in android
body: <p>I am using the front camera to take a picture and display it in image view, but the image is not captured using frontface camera in samsung galaxy tab. Can anybody tell what the problem is? Even I had given set picture format. I used getoptimalpreview size for preview size. Can anybody tell me if I missed anything? Preview is showing properly but clicking 'take picture' background is black</p>
  
  <pre><code>mCamera = Camera.open();
  Parameters params = mCamera.getParameters();
  params.set("camera-id", 2);
  params.setPictureFormat(PixelFormat.JPEG);
  </code></pre>
  
  <p>saving and setting display in imageview </p>
  
  <pre><code>public void onPictureTaken(byte[] data, Camera camera)
  {
  Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
  imv.setImageBitmap(bmp);
  String filename = "vijaypicture.jpg";
  File pictureFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + filename);
  try
  {
  FileOutputStream pfos = new FileOutputStream(pictureFile);
  bmp.compress(CompressFormat.JPEG, 75, pfos);
  pfos.flush();
  pfos.close();
  }
  catch (FileNotFoundException e)
  {
  e.printStackTrace();
  }
  catch (IOException e)
  {
  e.printStackTrace();
  }
  }
  </code></pre>