Last active
April 3, 2021 20:00
-
-
Save ch8n/9cd4314eb5c1ff8aa4d366de1fc00e9a to your computer and use it in GitHub Desktop.
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
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
... | |
val binding = MainLayoutBinding.inflate(layoutInflater) | |
setup(binding) | |
} | |
// write binding once and forget ✅ | |
fun setup(binding:MainLayoutBinding) = with(binding) { | |
textName.text = "ch8n" | |
textTwitter.text = "twitter@ch8n2" | |
} | |
// similar to withContext in coroutines ✅ | |
suspend fun foo() = withContext(Dispachers.IO){ | |
// .. do stuff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment