Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Created June 6, 2018 11:13
Show Gist options
  • Save EmmanuelGuther/04c4fa8acfa8260208e17cd7daafbbb9 to your computer and use it in GitHub Desktop.
Save EmmanuelGuther/04c4fa8acfa8260208e17cd7daafbbb9 to your computer and use it in GitHub Desktop.
A way to close all activities except one. Android Kotlin
fun closeActivitiesGoLogin(context: Context?) {
val intent = Intent(context, LoginActivity::class.java)
val cn = intent.component
val mainIntent = Intent.makeRestartActivityTask(cn)
context?.startActivity(mainIntent)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment