Erel suggests:
#SupportedOrientations attribute must be set to landscape or portrait. (in the compile log)
B4XPages will support ONE or the OTHER - I set it to unspecified
He states there is a workaround..
Below I created a workaround which seems to work well enough,,,
The sub Set_App_Port_or_Land gets the height and width - then sets portrait or landscape based the test.
Anyone see any problem with this ?
Code below from the Main Activity.
#SupportedOrientations attribute must be set to landscape or portrait. (in the compile log)
B4XPages will support ONE or the OTHER - I set it to unspecified
He states there is a workaround..
Below I created a workaround which seems to work well enough,,,
The sub Set_App_Port_or_Land gets the height and width - then sets portrait or landscape based the test.
Anyone see any problem with this ?
Code below from the Main Activity.
B4X:
#Region Project Attributes
#ApplicationLabel: B4A FusedExample
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified ' set to support either...
#CanInstallToExternalStorage: False
'#AdditionalJar: androidx.legacy:legacy-support-core-utils
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
#BridgeLogger: True
Sub Process_Globals
Public ActionBarHomeClicked As Boolean
Private ph As Phone
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
Set_App_Port_or_Land 'set port or land before initing the page manager...
Dim pm As B4XPagesManager
pm.Initialize(Activity)
End Sub
Sub Set_App_Port_or_Land
Dim lv As LayoutValues
lv = GetDeviceLayoutValues
If lv.Height > lv.Width Then ' Set app Orientation to Portrait
Log(" set portrait")
ph.SetScreenOrientation( 1 )
Else ' Set app Orientation to Landscape
Log(" set landscape")
ph.SetScreenOrientation( 0 )
End If
End Sub
'Template version: B4A-1.01
#Region Delegates
Sub Activity_ActionBarHomeClick
ActionBarHomeClicked = True
B4XPages.Delegate.Activity_ActionBarHomeClick
ActionBarHomeClicked = False
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
Return B4XPages.Delegate.Activity_KeyPress( KeyCode)
End Sub
' .......................