Hi,
i use this code in all my activities to the change status bar color
is it possible to put this function in Code Module and pass activity reference in the function instead ?
i use this code in all my activities to the change status bar color
B4X:
Sub SetStatusBarColor(clr As Int)
Dim p As Phone
If p.SdkVersion >= 21 Then
Dim jo As JavaObject
jo.InitializeContext
Dim window As JavaObject = jo.RunMethodJO("getWindow", Null) '<<<< how to call it from outside the activity
window.RunMethod("addFlags", Array (0x80000000))
window.RunMethod("clearFlags", Array (0x04000000))
window.RunMethod("setStatusBarColor", Array(clr))
End If
If p.SdkVersion >= 23 Then
jo = Activity
jo.RunMethod("setSystemUiVisibility", Array(8192))
End If
End Sub
is it possible to put this function in Code Module and pass activity reference in the function instead ?