AccessibilityNodeInfo - send text

这一生的挚爱 提交于 2019-12-03 06:49:57

You can use ACTION_PASTE from API 14, but you have to call AccessibilityRecordCompat and AccessibilityNodeInfoCompat like there:

AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
AccessibilityNodeInfoCompat source = record.getSource();
source.performAction(AccessibilityNodeInfo.ACTION_PASTE);

You could get the view that has the current focus:

public View getCurrentFocus() {
    return mWindow != null ? mWindow.getCurrentFocus() : null;
}

And then setting up the text:

editTextObject.setText(CharSequence)

Yes you can use AccessibilityNodeInfo even from API 14 and up but ACTION_PASTE you have to use only from Api Level 18. Have a look at http://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!