mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
Try other constructors besides first
This commit is contained in:
parent
8e31ef7be6
commit
df05f3a3c0
@ -219,16 +219,18 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
try {
|
||||
Class webViewClass = Class.forName(r);
|
||||
Constructor<CordovaWebView> [] 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<CordovaWebView> 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user