Android Custom Camera Screen inverted solution

Source: Internet
Author: User

Some of the phone's image is inverted, how to solve the problem? Please see below public static void setcameradisplayorientation (activity activity, int cameraid, Android.hardware.Camera Camera     {Android.hardware.Camera.CameraInfo info = new Android.hardware.Camera.CameraInfo ();     Android.hardware.Camera.getCameraInfo (Cameraid, info);     int rotation = Activity.getwindowmanager (). Getdefaultdisplay (). Getrotation ();     int degrees = 0;         Switch (rotation) {case Surface.ROTATION_0:degrees = 0; Case Surface.ROTATION_90:degrees = 90;         Break Case Surface.ROTATION_180:degrees = 180;         Break Case Surface.ROTATION_270:degrees = 270;     Break     } int result;         if (info.facing = = Camera.CameraInfo.CAMERA_FACING_FRONT) {result = (info.orientation + degrees)% 360;  result = (360-result)% 360;     Compensate The Mirror} else {//back-facing result = (info.orientation-degrees + 360)% 360; } camera.setdisplayorientation (result); }


@Overridepublic void surfacechanged (Surfaceholder arg0, int arg1, int arg2, int arg3) {//TODO auto-generated method stub& Lt;pre name= "code" class= "HTML" >                setcameradisplayorientation (This,0,camera)
}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.