'AccessibilityService - Perform ACTION_CLICK on unclickable item

I have tried to perform ACTION_CLICK on clickable item successfully. But, It's not working with unclickable item. Here my code:

List<AccessibilityNodeInfo> nodeInfoList = rootNode.findAccessibilityNodeInfosByViewId("com.VCB:id/tvLanguage");
            if (nodeInfoList == null || nodeInfoList.isEmpty())
                return;

            for (AccessibilityNodeInfo nodeInfo : nodeInfoList) {
                nodeInfo.setVisibleToUser(false);
                nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                Toast.makeText(getApplicationContext(), "Text:" + nodeInfo.getText(), Toast.LENGTH_SHORT).show();

Android widget TextView of "com.VCB:id/tvLanguage":

<android.widget.TextView index="1" package="com.VCB" class="android.widget.TextView" text="English" resource-id="com.VCB:id/tvLanguage" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[894,206][1019,252]" displayed="true" />

As you can see, the clickable="false", which not allow me to click it by AccessibilityService. Is there any approach to bypass this?

Thank you,



Solution 1:[1]

I don't know if you have found the answer but maybe you could try this:

nodeInfo.getParent().performAction(AccessibilityNodeInfo.ACTION_CLICK);

If you have your button inside a list or some place, maybe this could help you.

If that, does not work, check the documentation because it says that you can't call the setVisibleToUser() method from an AccessibilityService.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 largoWinch