I'm developping an android app which uses a USB OTG barcodescanner. We made a custom keyboard in a fragment and custom a EditText which communicates with our own keyboard fragment to write.
Everything works well, until I used a webview to display a web page, because we can't connect our custom keyboard to the webview, so we decided to show the native keyboard, but the native keyboard does not appear.
As I understand, when android detects the barcodescanner, it sets it as the default keyboard and I am not able to change to native keyboard unless I unplug the barcodescanner.
I am using lollipop.
I tryed to catch the onTouchEvent on the web view as suggested here, and I am able to detect onTouch Events, and detect when I touch a textbox
servicesWebView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
WebView.HitTestResult hr = ((WebView) v).getHitTestResult();
if(hr.getType() == 9) {
Toast.makeText(context, "touch textarea", Toast.LENGTH_SHORT).show();
}
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
return false;
}
});
Thanks in advance.