Try other constructors besides first

This commit is contained in:
Ian Clelland 2014-04-24 14:58:16 -04:00
parent 8e31ef7be6
commit df05f3a3c0

View File

@ -220,15 +220,17 @@ public class CordovaActivity extends Activity implements CordovaInterface {
Class webViewClass = Class.forName(r); Class webViewClass = Class.forName(r);
Constructor<CordovaWebView> [] webViewConstructors = webViewClass.getConstructors(); Constructor<CordovaWebView> [] webViewConstructors = webViewClass.getConstructors();
if(CordovaWebView.class.isAssignableFrom(webViewClass)) { if(CordovaWebView.class.isAssignableFrom(webViewClass)) {
CordovaWebView webView = (CordovaWebView) webViewConstructors[0].newInstance(this); for (Constructor<CordovaWebView> constructor : webViewConstructors) {
return webView; try {
} CordovaWebView webView = (CordovaWebView) constructor.newInstance(this);
else return webView;
{ } catch (IllegalArgumentException e) {
LOG.e(TAG, "The WebView Engine is NOT a proper WebView, defaulting to system WebView"); 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) { } catch (ClassNotFoundException e) {
LOG.e(TAG, "The WebView Engine was not found, defaulting to system WebView"); LOG.e(TAG, "The WebView Engine was not found, defaulting to system WebView");
} catch (InstantiationException e) { } catch (InstantiationException e) {