Hi,
in my app I use accessibility service
On acs_OnAccessibilityEvent I need to read views properties, so,
based on https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo page (see "Public methods" section)....
and it works very well !!
But now I want to read also bounds of view, so......
but when I "RunMethod" the error is:
java.lang.RuntimeException: Method: getBoundsInWindow not found in: android.view.accessibility.AccessibilityNodeInfo
method not found ????? ?
Why ??
Thanks
Sergio
in my app I use accessibility service
On acs_OnAccessibilityEvent I need to read views properties, so,
based on https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo page (see "Public methods" section)....
B4X:
Dim evento As JavaObject
Dim nodo As JavaObject
Sub acs_OnAccessibilityEvent (Event As Object, Node As Object)
nodo = Node
evento = Event
Dim EventType As Int = evento.RunMethod("getEventType", Null).As(Int)
Dim PackageName As String = evento.RunMethod("getPackageName", Null).As(String)
Dim nodes As JavaObject = nodo.RunMethod("get", Array As Object(0)) ' get all nodes
Dim nodesCount As Int = nodes.RunMethod("size", Null).As(Int) ' get the nodes count
For x = 0 To nodesCount - 1
Dim obj As JavaObject = nodes.RunMethodJO("get", Array As Object(x)) ' get the node
Dim ViewId As String = obj.RunMethod("getViewIdResourceName", Null).As(String) ' get the ViewId
Dim ClassName As String = obj.RunMethod("getClassName", Null).As(String)
Dim isClickable As Boolean = obj.RunMethod("isClickable", Null).As(Boolean)
' and so on with other proprieties....
Next
End Sub
and it works very well !!
But now I want to read also bounds of view, so......
B4X:
Dim outBounds As JavaObject
outBounds.InitializeStatic("android.graphics.Rect")
obj.RunMethod("getBoundsInWindow", Array As Object(outBounds))
but when I "RunMethod" the error is:
java.lang.RuntimeException: Method: getBoundsInWindow not found in: android.view.accessibility.AccessibilityNodeInfo
method not found ????? ?
Why ??
Thanks
Sergio
Last edited: