Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Dim getRes As JavaObject = GetContext.RunMethodJO("getResources", Null)
Dim getDisplay As JavaObject = getRes.RunMethodJO("getDisplayMetrics",Null)
Dim H As Int = getDisplay.GetField("heightPixels")
Dim W As Int = getDisplay.GetField("widthPixels")
Dim AspectRatio As Float = H / W
Log(AspectRatio)
Log(H)
Log(W)
If AspectRatio < 1.5 Then
Log("Negate")
End If
'OR more simple without javaobject only B4A
Log("*************")
Dim H1 As Int = GetDeviceLayoutValues.Height
Dim W1 As Int = GetDeviceLayoutValues.Width
Dim AspectRatio1 As Float = H1 / W1
Log(AspectRatio1)
Log(H1)
Log(W1)
If AspectRatio1 < 1.5 Then
Log("Negate")
End If
End Sub
Sub GetContext As JavaObject
Return GetBA.GetField("context")
End Sub
Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetFieldJO("processBA")
End Sub