List of usage examples for android.app Activity finishAffinity
public void finishAffinity()
From source file:Main.java
private static void quitAll(Activity activity) { activity.finishAffinity(); System.runFinalizersOnExit(true); System.exit(0);/*from w ww . j av a2 s. co m*/ }
From source file:Main.java
public static void finishApplication(@NonNull Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { activity.finishAffinity(); } else {//from www .ja v a 2s . c o m activity.finish(); System.exit(0); } }
From source file:de.baumann.browser.helper.helper_webView.java
public static void closeWebView(Activity from, WebView webView) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(from); if (sharedPref.getBoolean("clearCookies", false)) { CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookies(null); cookieManager.flush();/* ww w. j a v a 2 s . com*/ } if (sharedPref.getBoolean("clearCache", false)) { webView.clearCache(true); } if (sharedPref.getBoolean("clearForm", false)) { webView.clearFormData(); } if (sharedPref.getBoolean("history", false)) { from.deleteDatabase("history.db"); webView.clearHistory(); } helper_main.isClosed(from); sharedPref.edit().putString("started", "").apply(); from.finishAffinity(); }
From source file:com.medlog.medlogmobile.NewMessageNotification.java
public static AlertDialog.Builder eulaAlert(final Activity mActivity) { AlertDialog.Builder builder = new AlertDialog.Builder(mActivity).setTitle(" End-User License Agreement") .setMessage(EULATEEXT).setPositiveButton(android.R.string.ok, new Dialog.OnClickListener() { @Override//from www . j a v a2 s . co m public void onClick(DialogInterface dialogInterface, int i) { // Mark this version as read. SharedPreferences sp = mActivity.getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.putBoolean(mActivity.getString(R.string.PREF_EULA), true); editor.commit(); dialogInterface.dismiss(); } }).setNegativeButton(android.R.string.cancel, new Dialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Close the activity as they have declined the EULA mActivity.finishAffinity(); System.exit(0); } }); return builder; }
From source file:de.baumann.hhsmoodle.helper.helper_main.java
public static void onClose(final Activity activity) { PreferenceManager.setDefaultValues(activity, R.xml.user_settings, false); sharedPref = PreferenceManager.getDefaultSharedPreferences(activity); final ProgressDialog progressDialog; if (sharedPref.getBoolean("backup_aut", false)) { try {/*from ww w.j a v a 2 s. c o m*/ helper_security.encryptBackup(activity, "/bookmarks_DB_v01.db"); } catch (Exception e) { e.printStackTrace(); } try { helper_security.encryptBackup(activity, "/courses_DB_v01.db"); } catch (Exception e) { e.printStackTrace(); } try { helper_security.encryptBackup(activity, "/notes_DB_v01.db"); } catch (Exception e) { e.printStackTrace(); } try { helper_security.encryptBackup(activity, "/random_DB_v01.db"); } catch (Exception e) { e.printStackTrace(); } try { helper_security.encryptBackup(activity, "/subject_DB_v01.db"); } catch (Exception e) { e.printStackTrace(); } try { helper_security.encryptBackup(activity, "/schedule_DB_v01.db"); } catch (Exception e) { e.printStackTrace(); } try { helper_security.encryptBackup(activity, "/todo_DB_v01.db"); } catch (Exception e) { e.printStackTrace(); } progressDialog = new ProgressDialog(activity); progressDialog.setMessage(activity.getString(R.string.app_close)); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.show(); new Handler().postDelayed(new Runnable() { public void run() { sharedPref.edit().putString("loadURL", "").apply(); helper_security.encryptDatabases(activity); if (progressDialog.isShowing()) { progressDialog.cancel(); } activity.finishAffinity(); } }, 1500); } else { sharedPref.edit().putString("loadURL", "").apply(); helper_security.encryptDatabases(activity); activity.finishAffinity(); } }