0

I have a camera application and i want that whenever the camera is opened , it takes images only in the landscape mode ?? How can i achieve this??

Intent ia = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(ia,cameraData);

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    Log.d("value of pic1", ""+pic1);
    super.onActivityResult(requestCode, resultCode, data);
    if(resultCode == RESULT_OK){
        Bundle extras = data.getExtras();
        Bitmap bmp1 = (Bitmap) extras.get("data");
    }
}   
kablu
  • 629
  • 1
  • 7
  • 26
Kumar
  • 169
  • 2
  • 5
  • 12
  • look [here](http://stackoverflow.com/questions/8294868/issues-takeing-picture-with-android-vertical-camera-portrait) – Renard Jun 02 '12 at 08:54

4 Answers4

2

using this setDisplayOrientation u can do this thing see here

Parag Chauhan
  • 35,760
  • 13
  • 86
  • 95
1

In the AndroidManifest.xml file you specify the acceptable orientations for your application.

To force your activity to remain in landscape mode simply include the android:screenOrientation tag in your activity's definition tag.

<activity android:name=".SomeActivity" android:label="@string/app_name" android:screenOrientation="landscape">

And if you are opening the native application then you cant force the camera to take images in landscape mode. you wont have orientation control of your native application in your application.

Shankar Agarwal
  • 34,573
  • 7
  • 66
  • 64
  • 2
    i am opening the camera app.. i think to acheive this , i wil have to change in the manifest of the camera application that i cannot access?? – Kumar Jun 02 '12 at 08:52
1

To do this you can your own Camera Preview Activity rather than opening the Intent. You can do this easily by following this example. And make the Actvity Orientation Mode as Landscape.

Som
  • 1,514
  • 14
  • 21
0

specify the orientation as landscap for perticular Activity Tag , At which the screen is call for image capturing in AndroidManifest.xml file .

user1208720
  • 515
  • 2
  • 6