From df05f3a3c07c0630c3d598409289db7a8f3c87e3 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Thu, 24 Apr 2014 14:58:16 -0400 Subject: [PATCH] Try other constructors besides first --- .../org/apache/cordova/CordovaActivity.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index 01eff1c1..830332e4 100755 --- a/framework/src/org/apache/cordova/CordovaActivity.java +++ b/framework/src/org/apache/cordova/CordovaActivity.java @@ -219,16 +219,18 @@ public class CordovaActivity extends Activity implements CordovaInterface { try { Class webViewClass = Class.forName(r); Constructor [] webViewConstructors = webViewClass.getConstructors(); - - + if(CordovaWebView.class.isAssignableFrom(webViewClass)) { - CordovaWebView webView = (CordovaWebView) webViewConstructors[0].newInstance(this); - return webView; - } - else - { - LOG.e(TAG, "The WebView Engine is NOT a proper WebView, defaulting to system WebView"); + for (Constructor constructor : webViewConstructors) { + try { + CordovaWebView webView = (CordovaWebView) constructor.newInstance(this); + return webView; + } catch (IllegalArgumentException e) { + LOG.d(TAG, "Illegal arguments; trying next constructor."); + } + } } + LOG.e(TAG, "The WebView Engine is NOT a proper WebView, defaulting to system WebView"); } catch (ClassNotFoundException e) { LOG.e(TAG, "The WebView Engine was not found, defaulting to system WebView"); } catch (InstantiationException e) {