Skip to content

Instantly share code, notes, and snippets.

@dario61081
Created April 10, 2019 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dario61081/2b9eb0e95fa9fc74058beb800c9aa5c7 to your computer and use it in GitHub Desktop.
Save dario61081/2b9eb0e95fa9fc74058beb800c9aa5c7 to your computer and use it in GitHub Desktop.
Reiniciar aplicacion
public static void restart(Context context) {
PackageManager packageManager = context.getPackageManager();
Intent intent = packageManager.getLaunchIntentForPackage(context.getPackageName());
ComponentName componentName = intent.getComponent();
Intent mainIntent = Intent.makeRestartActivityTask(componentName);
context.startActivity(mainIntent);
System.exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment