Android Question [SOLVED]panel overlay

KZero

Active Member
Licensed User
Longtime User
Hi,

i'm using this code to add panel over all apps

B4X:
Sub AddOverlay
Dim mView As Panel
    mView.Initialize("")
    mView.Color=Colors.Red
   
    Dim mlp As JavaObject
    Dim vtype As Int = -1, pixelFormat As Int = -3
    mlp.InitializeNewInstance("android.view.WindowManager$LayoutParams", Array(vtype, 200, 2010,596, pixelFormat))
    mlp.SetField("gravity", Bit.Or(Gravity.TOP, Gravity.CENTER))
    Dim windowManager As JavaObject = GetContext.RunMethod("getSystemService", Array("window"))
    windowManager.RunMethod("addView", Array(mView, mlp))
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

it working ok but the keyboard and back button not working while this code is active !
 

KZero

Active Member
Licensed User
Longtime User
solved
B4X:
i changed  
mlp.InitializeNewInstance("android.view.WindowManager$LayoutParams", Array(vtype, 200, 2010,596, pixelFormat))
to
mlp.InitializeNewInstance("android.view.WindowManager$LayoutParams", Array(vtype, 200, 2006,596, pixelFormat))

changed 2010 to 2006

2010 is type_system_error which appear on top of everything and take the focus , 2006 is type_system_overlay

more here
https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html
 
Upvote 0
Top