I want to insert Barcode Scanner value(Reading barcode from a barcode scanner device which is connected to mobile) to a web page textbox field, that page is running in mobile chrome browser.
From the Android documentation on the ACTION_SET_TEXT.
Bundle arguments = new Bundle();
arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE,"android");
info.performAction(AccessibilityAction.ACTION_SET_TEXT.getId(), arguments);
Note that your info
object must be an AccessibilityNodeInfo that responds to this event. In Web speak, this means that the control must be rendered by Chrome to the assistive technology as an android.widget.EditText
or one of it's compatibility library cousins, or a subclass of either.
For example, the above solution would enter text into the login fields on FaceBook.com (which get rendered to the AT as android.widget.EditText
) but NOT the search field on Google.com, which gets rendered as a android.widget.Spinner
.
If a browser is using non-standard markup, and doing some wonky custom text entry thing, this solution won't work and you're essentially SOL.
You can find all of this out yourself and explore using the Android Device Monitor... excellent tool!