Android Question Go back to default view from immersive mode

cbanks

Active Member
Licensed User
Longtime User
I know the following code can take an app into immersive mode. But what is the code to go back to the default view so it's not in immersive mode? I want to switch between the two. Thanks.

B4X:
Dim p As Phone
If p.SdkVersion >= 28 Then
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    ctxt.RunMethodJO("getWindow", Null).RunMethodJO("getAttributes", Null).SetField("layoutInDisplayCutoutMode", 1)
End If
GetRealSize
Dim lv As LayoutValues = GetRealSize
Dim jo As JavaObject = Activity
jo.RunMethod("setBottom", Array(lv.Height))
jo.RunMethod("setRight", Array(lv.Width))
Activity.Height = lv.Height
Activity.Width = lv.Width

Dim jo As JavaObject = Activity
jo.RunMethod("setSystemUiVisibility", Array As Object(5894))
 
Top