Created
December 29, 2019 03:35
-
-
Save hafizrahman/b5cdad776367124ee870f357b5d23476 to your computer and use it in GitHub Desktop.
Example of View Binding using Kotlin Extension
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
// 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