title: how to capture picture portrait mode set portrait mode?
body: <p>i have camera activity. and i capture picture but in camera preview not show picture portrait mode . how to possible in android . my code below . </p>
  
  <pre><code>public class CameraActivity extends Activity {
  
      private Camera mCamera;
      private CameraPreview mCameraPreview;
      protected static final int MEDIA_TYPE_IMAGE = 0;
      static String FilePAth = "";
      Button takePicture;
      static String base64string="";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.camera_preview);
  
          mCamera = getCameraInstance();
          mCameraPreview = new CameraPreview(CameraActivity.this, mCamera);
          FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
          preview.addView(mCameraPreview);
  
          takePicture = (Button) findViewById(R.id.btnTakePicture);
          takePicture.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
  
                  mCamera.takePicture(null, null, mPicture);
  
              }
          });
      }
  
      private Camera getCameraInstance() {
          Camera camera = null;
          try {
              camera = Camera.open();
          } catch (Exception e) {
              // cannot get camera or does not exist
          }
          return camera;
      }
  
      private static File getOutputMediaFile() {
          File mediaStorageDir = new File(
                  Environment
                          .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
                  "MyCameraApp");
          if (!mediaStorageDir.exists()) {
              if (!mediaStorageDir.mkdirs()) {
                  Log.d("MyCameraApp", "failed to create directory");
                  return null;
              }
          }
          // Create a media file name
          String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss")
                  .format(new Date());
  
          FilePAth = mediaStorageDir.getPath() + File.separator + "IMG_"
                  + timeStamp + ".jpg";
  
          Log.v("log", " FilePAth " + FilePAth);
  
          File mediaFile;
          mediaFile = new File(mediaStorageDir.getPath() + File.separator
                  + "IMG_" + timeStamp + ".jpg");
  
          return mediaFile;
      }
  
      PictureCallback mPicture = new PictureCallback() {
          @Override
          public void onPictureTaken(byte[] data, Camera camera) {
              File pictureFile = getOutputMediaFile();
              if (pictureFile == null) {
                  return;
              }
              try {
  
                  FileOutputStream fos = new FileOutputStream(pictureFile);
                  fos.write(data);
                  fos.close();
  
                  Intent returnIntent = new Intent();
                  returnIntent.putExtra("data", data);
                  setResult(RESULT_OK, returnIntent);
                  finish();
  
              } catch (FileNotFoundException e) {
  
              } catch (IOException e) {
              }
          }
      };
  
      public void onBackPressed() {
          Intent returnIntent = new Intent();
          returnIntent.putExtra("path", FilePAth);
          setResult(RESULT_OK, returnIntent);
          finish();
      };
  }
  </code></pre>
  
  <p>and get data :</p>
  
  <pre><code>@Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          Log.v("log", " data --&gt; " + data.getByteArrayExtra("data"));
          if (requestCode == 1) {
  
              if (data.hasExtra("data")) {
  
                  Log.v("log", " request if ");
  
                  Bitmap b = BitmapFactory.decodeByteArray(
                          data.getByteArrayExtra("data"), 0,
                          data.getByteArrayExtra("data").length);
  
  
  
                  imgStorePicture.setImageBitmap(b);
                  /*imgStorePicture.setScaleType(ScaleType.FIT_XY);*/
  
                  base64string = Base64.encodeBytes(data
                          .getByteArrayExtra("data"));
                  Log.v("log", "base64string " + base64string);
  
  
  
  
  
              }
          }
      }
  </code></pre>