Reputation: 857
I am trying to open a webpage inside web view and it is working fine on andoid 4.1.2 and below, but when I tried the same code in android 4.2.2 i.e nexus 4 it is not taking any input from keyboard.
When i click on any edit text on web page keyboard gets open and it also show the focus on edit text, but as soon as I press any character keyboard focus lost from the edit text and nothing gets typed on the field. be low is my code
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.setWebViewClient(new MyWebViewClient());
mWebView.clearHistory();
mWebView.clearFormData();
mWebView.clearCache(true);
mWebView.loadUrl(strUrl);
mWebView.requestFocus();
/**
* webview client
*/
private class MyWebViewClient extends WebViewClient {
@Override
// show the web page in webview but not in web browser
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if ( !getSuceessParams(url) )
view.loadUrl(url);
return true;
}
@Override
public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
handler.proceed("checkin", "4good");
}
@Override
public void onPageFinished(WebView view, String url) {
System.out.println("onPageFinished " + url);
context.removeDialog(0);
super.onPageFinished(view, url);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
System.out.println("onPageStarted " + url);
Fragment fragment = context.getLastFragment();
if ( fragment.getTag() == "campaign_donation_web_fragment" ) {
CheckinLibraryActivity.strProgressMessage = "Loading..";
context.showDialog(0);
}
super.onPageStarted(view, url, favicon);
}
}
I am getting following error
****Should not happen: no rect-based-test nodes found
Thanks
Upvotes: 1
Views: 409
Reputation: 3022
In my case TabHost
from a previous fragment in back stack was stealing the focus on every key press. Here's how I fixed it:
tabHost.addOnAttachStateChangeListener(new OnAttachStateChangeListener() {
@Override
public void onViewDetachedFromWindow(View v) {}
@Override
public void onViewAttachedToWindow(View v) {
tabHost.getViewTreeObserver().removeOnTouchModeChangeListener(tabHost);
}
});
See https://code.google.com/p/android/issues/detail?id=2516 for more on the topic.
Upvotes: 0
Reputation: 757
I had a similar issue and it seemed to be fixed by not using the SwiftKey keyboard instead using the Google keyboard. http://support.swiftkey.net/forums/116693-2-bug-reports/suggestions/3808949-phonegap-app
Upvotes: 1