How to save proper orientation image in camera in android
<p>I am capturing picture using custom front  camera and saving in media store .but saving image in media store but its not saving proper orientation.If I am in potrait mode it is displaying in landscape mode. can anybody tell what is problem How to i resolve the problem ?  I will post my below code for saving image</p>

<pre><code>try
                {



                    int rotation = EditCameraActivity.this.getWindowManager().getDefaultDisplay()
                    .getRotation();
                    int degrees = 0;
                    switch (rotation) {
                    case Surface.ROTATION_0: degrees = 0; break;
                    case Surface.ROTATION_90: degrees = 90; break;
                    case Surface.ROTATION_180: degrees = 180; break;
                    case Surface.ROTATION_270: degrees = 270; break;
                    }   
                Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); 
               //((ImageView)findViewById(R.id.pictureView)).setImageBitmap(x); 
               ContentValues values = new ContentValues(); 
               values.put(Images.Media.TITLE, "s"); 
               values.put(Images.Media.BUCKET_ID, "test"); 
               values.put(Images.Media.DESCRIPTION, "test Image taken"); 
               values.put(Images.Media.MIME_TYPE, "image/jpeg"); 
               values.put(Images.Media.ORIENTATION,degrees);


// compensate the mirror

               Uri uri = getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); 


               OutputStream outstream; 

               outstream = getContentResolver().openOutputStream(uri); 
             //outstream.write(data); 
               bitmap.compress(Bitmap.CompressFormat.JPEG, 70, outstream); 
               outstream.close(); 
             imagePath=getPath(uri);
             System.out.println("*************");
             System.out.println("path is"+path);
             System.out.println("***************");
              Intent resultIntent = new Intent(EditCameraActivity.this,CheckActivity.class); 
               startActivity(resultIntent);
              //resultIntent.putExtra("ImagePath", imagePath);
           // TODO Add extras or a data URI to this intent as appropriate. 
           //setResult(Activity.RESULT_OK, resultIntent); 
           //finish(); 

               } catch (Exception e) { 
                   e.printStackTrace();
               // 
               }
</code></pre>
