Force to camera take picture in specified angle
<p>I am developing one application in which i need to give orientation to camera at run-time. so i have lock it by activity orientation at runtime 
<code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);</code> and <code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);</code>
according to data..</p>

<p>i have take Surfaceview to capture camera snap short.now here problem is how can i take snap in Landscap or portait only.i also want to lock orientarion.
e.g suppose i have one buststop pillow  and requirement is "capture photo of entire pillow" and obviosly it should take in portrait mode only.and i start camera portrait mode but when user change orientation of that camera, it's meaningless. so i would like to take picture in portrait.and same scenario for "Landscap"</p>

<p>here is picture further more clear..</p>

<p><img src="http://i.stack.imgur.com/tYKr5.png" alt="enter image description here"></p>

<p>as you show in this picture , captured portrait image are display its fine but when camara should rotate to landscap it can still capture in portrait only. and same for vice-verse  </p>

<p>please help for this..</p>

<p><strong>here some code that i have tryed..</strong> </p>

<pre><code>if (!previewing) {

                        camera = Camera.open();
                        //camera.setDisplayOrientation(90);
                        if (camera != null) {
                            try {
                                  Parameters parameters = camera.getParameters();

                                  if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
                                    {   
                                      parameters.set("orientation", "portrait");
                                      parameters.set("rotation",90);
                                    }
                                    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
                                    {                               
                                        parameters.set("orientation", "landscape");          
                                        parameters.set("rotation", 90);
                                    }

                                  //parameters.setRotation(90);       
                                  camera.setParameters(parameters); 
                                camera.setPreviewDisplay(surfaceHolder);
                                camera.startPreview();
                                previewing = true;
                            } catch (IOException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }
                        }
                    }
                }
</code></pre>
