My Code Module (SupportedOrientationsScreen) is belows
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Public Orientation As String
End Sub
Sub SelectOrientation As String
If GetDeviceLayoutValues.Width > GetDeviceLayoutValues.Height Then
Orientation = "Landscape"
Else
Orientation = "Portrait"
End If
Return Orientation
End Sub
My code is belows
B4X:
Sub Activity_Create(firstTime As Boolean)
'put this code in a code module and call it from Activity_Resume of each activity.
'for SupportedOrientations possible values: unspecified, landscape or portrait
Activity.LoadLayout("1")
:::
End Sub
Sub Activity_Resume
IIf(SupportedOrientationsScreen.SelectOrientation="Portrait",Activity.LoadLayout("1"),Activity.LoadLayout("2"))
:::
End Sub
Sub Activity_Resume
'reset screen Orientation
Activity.RemoveAllViews
Activity_Create(False)
:::
End Sub
P.S.
B4X:
IIf(SupportedOrientationsScreen.SelectOrientation="Portrait",Activity.LoadLayout("1"),Activity.LoadLayout("2")) 'Not Worked
'------------------------------------------------------------------------------------------------
If SupportedOrientationsScreen.SelectOrientation="Portrait" then 'Worked
Activity.LoadLayout("1")
Else
Activity.LoadLayout("2")
End If
Thank you ,Areric again. ArericGPT is fast answer. I like this GPT.