Merge pull request #6495 from danielmbutler/Replace-System.exit-calls
Replace the System.exit calls with getActivity.finishAffinity()
This commit is contained in:
commit
841fb4cfc5
3 changed files with 17 additions and 2 deletions
|
|
@ -600,4 +600,16 @@ public final class NavigationHelper {
|
|||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish this <code>Activity</code> as well as all <code>Activities</code> running below it
|
||||
* and then start <code>MainActivity</code>.
|
||||
*
|
||||
* @param activity the activity to finish
|
||||
*/
|
||||
public static void restartApp(final Activity activity) {
|
||||
activity.finishAffinity();
|
||||
final Intent intent = new Intent(activity, MainActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue