Android Question Need to set the orientation preview on camEx to portrait.

microbox

Active Member
Licensed User
Longtime User
Is there a way to set the desired start preview orientation to portrait, I'm having this issue of wrong orientation when previewing.
Image to left is the preview and at the right when image saved and loaded to imageview.
orientationprob2.png
 
Last edited:

microbox

Active Member
Licensed User
Longtime User
I have sorted out the fix...
B4X:
Private Sub Camera_Ready (Success As Boolean)
    If Success Then
        r.target = cam
        nativeCam = r.GetField("camera")
        r.target = nativeCam
        parameters = r.RunMethod("getParameters")
        Log("Parameter: " & parameters)
        SetDisplayOrientation ''-- needed to call this to set
    Else
        Log("success = false, " & LastException)
    End If
    CallSub2(target, event & "_ready", Success)
End Sub
 
Upvote 0

microbox

Active Member
Licensed User
Longtime User
I also managed to solve the saved image orientation...by relying on the width and height of the device.
B4X:
If photoWidth > 900 Then
    RotateView(imgphoto,0)
Else
    RotateView(imgphoto,90)
End If
imgphoto.SetBackgroundImage(im).Gravity = Gravity.FILL
 
Last edited:
Upvote 0
Top