I want to lock my camera view to "Landscape" mode.When I click on the simple button in my app, that time device's camera will open and and that camera should be locked to "Landscape mode". Can anyone know the solution of this problem?
I am using this code inside "CaptureImageActivity.java" activity. So after execution of this activity my system's camera will open.
btn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i=new Intent(android.provider.MediaStore. ACTION_IMAGE_CAPTURE);
i.putExtra(android.provider.MediaStore.EXTRA_SCREEN_ORIENTATION,ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
startActivityForResult(i,1000);
}
});
And I want to lock that camera view to "LandScape Mode". And as per solution
<activity android:name=".CaptureImageActivity"
android:screenOrientation="landscape"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Only "CaptureImageActivity" activity is locked to "LandScape Mode".
see this link to lock your camera orientation,use setDisplayOrientation (int degrees)
documentation can be found on following link : http://developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation%28int%29
for more details see this answer :
How to set Android camera orientation properly?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With