Last active
March 23, 2024 18:44
-
-
Save easterapps/7127ce0749cfce2edf083e55b6eecec5 to your computer and use it in GitHub Desktop.
restart android application programmatically
This file contains hidden or 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
fun triggerRestart(context: Activity) { | |
val intent = Intent(context, MainActivity::class.java) | |
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | |
context.startActivity(intent) | |
if (context is Activity) { | |
(context as Activity).finish() | |
} | |
Runtime.getRuntime().exit(0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awesome, help me solve memory leak of DexClassLoader