diff --git a/framework/src/org/apache/cordova/AndroidWebView.java b/framework/src/org/apache/cordova/AndroidWebView.java index a5f568b4..60296a9a 100755 --- a/framework/src/org/apache/cordova/AndroidWebView.java +++ b/framework/src/org/apache/cordova/AndroidWebView.java @@ -163,16 +163,6 @@ public class AndroidWebView extends WebView implements CordovaWebView { private void initWebViewSettings() { this.setInitialScale(0); this.setVerticalScrollBarEnabled(false); - // TODO: The Activity is the one that should call requestFocus(). - if (shouldRequestFocusOnInit()) { - this.requestFocusFromTouch(); - } - this.setInitialScale(0); - this.setVerticalScrollBarEnabled(false); - if (shouldRequestFocusOnInit()) { - this.requestFocusFromTouch(); - } - // Enable JavaScript final WebSettings settings = this.getSettings(); settings.setJavaScriptEnabled(true); settings.setJavaScriptCanOpenWindowsAutomatically(true); @@ -267,16 +257,6 @@ public class AndroidWebView extends WebView implements CordovaWebView { } } - /** - * Override this method to decide whether or not you need to request the - * focus when your application start - * - * @return true unless this method is overriden to return a different value - */ - protected boolean shouldRequestFocusOnInit() { - return true; - } - private void exposeJsInterface() { if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) { Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old."); diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index 08876aba..9aa5e1f0 100755 --- a/framework/src/org/apache/cordova/CordovaActivity.java +++ b/framework/src/org/apache/cordova/CordovaActivity.java @@ -147,6 +147,8 @@ public class CordovaActivity extends Activity { if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) { setVolumeControlStream(AudioManager.STREAM_MUSIC); } + + appView.getView().requestFocusFromTouch(); } @SuppressWarnings("deprecation")