Click on a view using accessibily service

0

This is my function to change the text in the address bar. but ACTION_CLICK does not work for me

 @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void Cambiarurl(AccessibilityEvent accessibilityEvent){
    AccessibilityNodeInfo source = accessibilityEvent.getSource();
    if (source != null &
            "android.widget.EditText".equals(accessibilityEvent.getClassName())) {
        Bundle arguments = new Bundle();

        String typedDetails;
        typedDetails = source.getText().toString();

        Log.d("typed text", source.getText().toString());

        if (typedDetails.contains("facebook")) {
                        }
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, "http://localhost:5358/");
            }
           // final AccessibilityNodeInfo clickableParent = source.getParent();

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            source.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);
            source.performAction(AccessibilityNodeInfo.ACTION_CLICK);
        }
    }
}
    
asked by Nelson Redondo Barros 21.03.2018 в 23:40
source

0 answers