public void onClick(View v) {
    if (v == btn_camera) {
        Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        Date date = new Date();
        DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
        String newPicFile = "Miuzz"+ df.format(date) + ".jpg";
        String outPath = "/sdcard/" + newPicFile;
        File outFile = new File(outPath);
        mUri = Uri.fromFile(outFile);
        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, mUri);
        startActivityForResult(cameraIntent, 1);
    }
}
I use this to call camera function and then past to another activity for some uploading, but the orientation of photo is wrong. I know that it is impossible to change orientation after photo saving, others only try to display it as well by rotate and create new bitmap.
but i am going to upload a camera photo, how can i detect camera orientation and save image as that orientation, so that after i upload the image to the sever, the image will save as a right orientation?
 
     
    