#StackBounty: #javascript #android #webview #inputconnection Keyboard issues while using BaseInputConnection inside the Custom Webview …

Bounty: 50

I have overridden the onCreateInputConnection inside the Custom WebView class like below

class CustomWebView extends WebView {
    public CustomWebView(@Nullable Context context) {

    public CustomWebView(@Nullable Context context,@Nullable AttributeSet attrs) {
        super(context, attrs);

    public CustomWebView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    public InputConnection onCreateInputConnection(EditorInfo outAttrs) { 
        // below return statement would be the default implementation
        // return super.onCreateInputConnection(outAttrs)
        return new BaseInputConnection(this, false);

Some editable HTML content is loaded into the above Custom Webview, place the below sample editor.html in the asset folder

<body contenteditable="true">

<h1> this is a sample text </h1></br>
<h2> h2 text</h1>


Main Issue when BaseInputConnection used in WebView:
I am not able to perform glide typing or swipe letter typing using the keyboard. This behavior is observed only when BaseInputConnection is used whereas in default implementation glide typing is performed

Other issues when BaseInputConnection used in WebView
In some devices like Redmi, the letters are not sent to the Webview while typing using soft keyboard.

I am overriding it to BaseInputConnection because it solves many of my problems in other use-cases. Any help on resolving the keyboard issue would be really appreciated

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.