Sub FullScreen(active As Boolean,ActivityName As String)
Dim obj1 As Reflector
obj1.Target = obj1.GetMostCurrent(ActivityName)
obj1.Target = obj1.RunMethod("getWindow")
'remove previous parameters
obj1.RunMethod2("clearFlags",1024,"java.lang.int")
obj1.RunMethod2("clearFlags",2048,"java.lang.int")
'add new parameter
If active Then
obj1.RunMethod2("addFlags",1024,"java.lang.int") 'FLAG_FULLSCREEN
Else
obj1.RunMethod2("addFlags",2048,"java.lang.int") 'FLAG_FORCE_NOT_FULLSCREEN
End If
End Sub
.
.
.
'Calling within main activity
FullScreen(True,"Main")
' or
FullScreen(False,"Main")
Sub FullScreen(Active As Boolean, ActivityName As String)
Dim obj1 As Reflector
Dim i As Int
i = 1024 'FLAG_FULLSCREEN
obj1.Target = obj1.GetMostCurrent(ActivityName)
obj1.Target = obj1.RunMethod("getWindow")
If Active Then
obj1.RunMethod2("addFlags",i,"java.lang.int")
Else
obj1.RunMethod2("clearFlags",i,"java.lang.int")
End If
End Sub
obj1.RunMethod2("clearFlags",1024,"java.lang.int")
obj1.RunMethod2("clearFlags",2048,"java.lang.int")
You may check if 100%x and 100%y change their values after you perform the FullScreen.
If so, you can always use Activity.ReRunDesignerScript("somescript", 100%x, 100%y).
But you should tell us if you are using layouts or creating views from code.
Activity.Height (or 100%y) should return the actual available height (similar to WinForms ClientSize).
One last question here then (I know it should be in a new thread, but it is related ), is there a proper way of restarting/resetting the Activity, so it recreates. (Obviously the way I'm doing it in that last test isn't enough.)The problem is that the Activity.Height value is only measured once when the activity is created. Maybe you can use two activities. One full screen and one not.
Sub Process_Globals
'Add this next line
Dim fs_RESET As Boolean
End Sub
Sub Globals
'Add this next line
Dim phn As Phone
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Add these to top of Sub
If fs_RESET = True Then
phn.SetScreenOrientation(7)
fs_RESET = False
End If
End Sub
Sub but3_Click
'Add these two lines, and comment out the other two
fs_RESET = True
phn.SetScreenOrientation(6)
' StartService("FSToggle")
' Activity.Finish
End Sub
You can try to call Activity.Finish followed by CallSubDelayed("", ...) (or StartActivity). It should destroy the activity and then create it again.