Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of View Binding using Kotlin Extension
// Using R.layout.activity_main from the 'main' source set
import kotlinx.android.synthetic.main.activity_main.*
class MyActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Instead of findViewById<TextView>(R.id.textView)
textView.setText("Hello, world!")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment