2

I am using custom camera and surface view. But the problem is the camera orientation is not displaying in proper mode.

I tried with this code:

Camera.Parameters p = c.getParameters();
parameters.set("orientation", "portrait");
parameters.set("rotation", 90);
c.setParameters(p);

and also with this code:

mCamera.setDisplayOrientation(mRotation); 

But no effect. If there any other solution for this. Please tell me.
James Wiseman
  • 29,946
  • 17
  • 95
  • 158
kalpana c
  • 2,739
  • 3
  • 27
  • 47
  • 1
    I went through the code and i think this will help you [Check This][1] [1]: http://stackoverflow.com/questions/4645960/how-to-set-android-camera-orientation-properly – Terril Thomas Oct 03 '12 at 09:30

1 Answers1

2

mCamera.setDisplayOrientation(90) works perfectly for me on the devices i tested, with one notable exception (it's quite a long shot but it might explain your issue): the Samsung Galaxy Ace, on which this function does not work as expected.

mbrenon
  • 4,851
  • 23
  • 25
  • I am testing on Samsung Galaxy Ace and Samsung Galaxy Y. – kalpana c Oct 03 '12 at 09:38
  • Thanks. As per you suggestion I tested on HTC one and Also LG and work perfectly with this code. if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){camera.setDisplayOrientation(90);parameters.set("orientation", "portrait");parameters.set("rotation",90);} – kalpana c Oct 03 '12 at 09:51
  • How did you fix the problem on the Galaxy Ace? I'm having that issue right now. – Jorge Garcia Mar 21 '13 at 00:54
  • As far as I know, you just can't fix it: it's mostly a hardware problem. It might be possible to re-code manually a function that does that, but I guess the performance would be very bad. And it's probably not an easy task either... – mbrenon Mar 21 '13 at 08:41
  • Hi, did anyone managed to fix the problem on the Galaxy Ace device? Thanks in advance. – Paul Jul 08 '13 at 17:59