Droidman
Droidman

Reputation: 11608

android WebView - content not editable

I use a WebView to authorize a user on a social network using their API.

My WebView loads a form with 2 EditTexts(or whatever they're called in web development) and a button.

The strange issue: the keyboard does not show up when clicking on an EditText in the form BUT if the activity gets paused and resumed (for example I press HOME and then come back) the EditTexts become editable and I'm able to enter login data.

LogCat output for complete procedure (opening page, pausing activity and coming back) goes below. Yeah, I also noticed the wrong spelled "false". Any ideas?

 02-24 18:33:16.310: V/webview(19204):  singleCursorHandlerTouchEvent -getEditableSupport  FASLE 
 02-24 18:33:16.715: V/webview(19204): doShortPress : mNativeClass - 1407128 mPreventDefault -  0
 02-24 18:33:16.810: D/dalvikvm(19204): GC_CONCURRENT freed 299K, 48% free 3037K/5831K, external 604K/1033K, paused 7ms+4ms
 02-24 18:33:16.830: D/navcache(19204): cursorInputFieldAction cursor=39c108, cursorFrame=1a7928
02-24 18:33:16.830: D/navcache(19204): CachedFrame::previousInputField this=1a7928, start=39c108, begin=39c040 end=39c3c4
02-24 18:33:16.830: D/navcache(19204): CachedFrame::nextInputField this=1a7928, start=39c108, begin=39c040 end=39c3c4
02-24 18:33:16.830: D/navcache(19204): cursorInputFieldAction next=39c16c, prev=0, action=4
02-24 18:33:17.095: V/webview(19204): OnSizeChanged: Enter 

Upvotes: 4

Views: 3628

Answers (1)

Pragnani
Pragnani

Reputation: 20155

I have found something in the Google group try this

webview.requestFocus(View.FOCUS_DOWN);
        webview.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                    case MotionEvent.ACTION_UP:
                        if (!v.hasFocus()) {
                            v.requestFocus();
                        }
                        break;
                }
                return false;
            }
        });

Upvotes: 4

Related Questions