B4X:
Public Sub getNavigationBarHeight(pbolPortrait As Boolean) As Int
Dim intHeight As Int
#If B4a
Dim strIdentifier As String
Dim intRessourceId As Int
Dim ctxt As JavaObject
Dim res As JavaObject
Dim ph As Phone
ctxt.InitializeContext
intHeight = 0
If ph.SdkVersion < 14 Then
Return 0
End If
If hasPermanentMenuKey Or Not(hasNavigationBar) Then
Return 0
End If
If pbolPortrait Then
strIdentifier = "navigation_bar_height"
Else
strIdentifier = "navigation_bar_width" ' Or navigation_bar_height_landscape?
End If
res = ctxt.RunMethodJO("getResources", Null)
If Not(res = Null) Then
intRessourceId = res.RunMethod("getIdentifier", Array(strIdentifier, "dimen", "android"))
If intRessourceId > 0 Then
intHeight = res.RunMethod("getDimensionPixelSize", Array(intRessourceId))
End If
End If
#Else
intHeight = 0
#End If
Return intHeight
End Sub
B4X:
Public Sub hasNavigationBar() As Boolean
Dim bolHasNavBar As Boolean
#If B4a
Dim intRessourceId As Int
Dim ctxt As JavaObject
Dim res As JavaObject
ctxt.InitializeContext
res = ctxt.RunMethodJO("getResources", Null)
intRessourceId = res.RunMethod("getIdentifier", Array("config_showNavigationBar", "bool", "android"))
If intRessourceId > 0 Then
bolHasNavBar = res.RunMethod("getBoolean", Array(intRessourceId))
End If
#Else
bolHasNavBar = False
#End If
Return bolHasNavBar
End Sub
I have no clue what is notch? Is notch at the very top of screen? I have 132 height for notch. I do have navigation bar as seen attached. Why is navigation bar at 0 height? this code was from the other thread. I do want the height of navigation bar.