Created
August 30, 2017 20:15
-
-
Save cloudshooterhuman/ec3f18e31618c8648077fb224416521a to your computer and use it in GitHub Desktop.
Simplifying the startActivity function on Android using reified type parameter
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
inline fun<reified T:Activity>Context.startActivity() { | |
val intent = Intent(this, T:: class.java) | |
startActivity(intent) | |
} | |
startActivity<DetailActivity>() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment