/** Display an error dialog and optionally exit application. */ public void displayError( final String title, final String message, final String button, final boolean exit) { final CordovaActivity me = this; me.runOnUiThread( new Runnable() { public void run() { try { AlertDialog.Builder dlg = new AlertDialog.Builder(me); dlg.setMessage(message); dlg.setTitle(title); dlg.setCancelable(false); dlg.setPositiveButton( button, new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); if (exit) { me.endActivity(); } } }); dlg.create(); dlg.show(); } catch (Exception e) { finish(); } } }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // Set by <content src="index.html" /> in config.xml loadUrl(launchUrl); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // Set by <content src="index.html" /> in config.xml super.loadUrl(Config.getStartUrl()); }
/** * Report an error to the host application. These errors are unrecoverable (i.e. the main resource * is unavailable). The errorCode parameter corresponds to one of the ERROR_* constants. * * @param errorCode The error code corresponding to an ERROR_* value. * @param description A String describing the error. * @param failingUrl The url that failed to load. */ public void onReceivedError( final int errorCode, final String description, final String failingUrl) { final CordovaActivity me = this; // If errorUrl specified, then load it final String errorUrl = preferences.getString("errorUrl", null); if ((errorUrl != null) && (errorUrl.startsWith("file://") || whitelist.isUrlWhiteListed(errorUrl)) && (!failingUrl.equals(errorUrl))) { // Load URL on UI thread me.runOnUiThread( new Runnable() { public void run() { // Stop "app loading" spinner if showing me.spinnerStop(); me.appView.showWebPage(errorUrl, false, true, null); } }); } // If not, then display error dialog else { final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP); me.runOnUiThread( new Runnable() { public void run() { if (exit) { me.appView.setVisibility(View.GONE); me.displayError( "Application Error", description + " (" + failingUrl + ")", "OK", exit); } } }); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // Set by <content src="index.html" /> in config.xml loadUrl(launchUrl); WebSettings ws = super.appView.getSettings(); ws.setMediaPlaybackRequiresUserGesture(false); }
@JavascriptInterface @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set by <content src="index.html" /> in config.xml super.init(); WebView wv = (WebView) appView.getEngine().getView(); wv.addJavascriptInterface(this, "MainActivity"); loadUrl(launchUrl); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // Set by <content src="index.html" /> in config.xml super.loadUrl(Config.getStartUrl()); // super.loadUrl("file:///android_asset/www/index.html"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WebView.setWebContentsDebuggingEnabled(true); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); super.setIntegerProperty("splashscreen", R.drawable.splash); // Set by <content src="index.html" /> in config.xml super.loadUrl("file:///android_asset/www/index.html", 3000); // super.loadUrl(Config.getStartUrl()); // super.loadUrl("file:///android_asset/www/index.html") }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Set by <content src="index.html" /> in config.xml super.loadUrl(Config.getStartUrl()); // super.loadUrl("file:///android_asset/www/sharedLayer/shared.html"); super.loadUrl("file:///android_asset/www/index.html"); super.setIntegerProperty("loadUrlTimeoutValue", 60000); }
/** * The IBM MobileFirst Platform calls this method after its initialization is complete and web * resources are ready to be used. */ public void onInitWebFrameworkComplete(WLInitWebFrameworkResult result) { if (result.getStatusCode() == WLInitWebFrameworkResult.SUCCESS) { super.loadUrl(WL.getInstance().getMainHtmlFilePath()); } else { handleWebFrameworkInitFailure(result); } }
/** * Called when activity starts. Initializes Instabug. * * @param savedInstanceState Saved instance state */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Retrieve initialization options Bundle options = getIntent().getExtras(); IBGInvocationEvent event = IBPlugin.parseInvocationEvent(options.getString("invocationEvent")); if (event != null) { // Initialize builder with invocation event if possible builder = new Instabug.Builder(this.getApplication(), options.getString("token"), event); } else { builder = new Instabug.Builder(this.getApplication(), options.getString("token")); } // Apply initialization options through builder setBuilderOptions(options); // builder.setShouldShowIntroDialog(false); // Initialize Instabug through builder builder.build(); // Finish activity (required for no-display theme) IBPluginActivity.this.finish(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WL.createInstance(this); WL.getInstance().showSplashScreen(this); WL.getInstance().initializeWebFramework(getApplicationContext(), this); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); loadUrl("file:///android_asset/www/fragment2.html"); }