I am invoking a camera using an intent and clicking a picture. Presently I am on emulator and would like to force camera to click the pictures in portrait mode(need to captu
This shoudl work:
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
i.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
startActivityForResult(i, CAMERA_CODE);
None of the solutions work.There is nothing wrong with the layouts either.I got it to work by running on a higher version(API10 to API15). Weird!!
You only need to set Id for each of your views. You don't need to force portrait mode in camera. Doing this, prevent the activity to recreate views and losing data
Write in your manifest.xml where you have defined your this activity.
<activity android:name="your_activity name" android:screenOrientation="portrait" />
This should work. I suggest you to check in real device.
use this code for your image capturing class where your preview is starting.
I think this is a known problem, see Camera|SetDisplayOrientation