Created
April 10, 2019 15:17
-
-
Save dario61081/2b9eb0e95fa9fc74058beb800c9aa5c7 to your computer and use it in GitHub Desktop.
Reiniciar aplicacion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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