Last active
May 23, 2019 06:07
-
-
Save sierisimo/fa2fdfab22f3613cfb34d76af480305a to your computer and use it in GitHub Desktop.
Single function to launch an activity with a simple function and allow the inline build of the extras #kotlin #android
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
inline fun <reified T : Activity> Context.launchActivity(intentBlock: Intent.() -> Unit = {}) { | |
val intent = Intent(this, T::class.java) | |
intent.intentBlock() | |
startActivity(intent) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment