Skip to content

Instantly share code, notes, and snippets.

Created September 5, 2021 07:49
What would you like to do?
How to Use View Binding with Kotlin - 4
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
// setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
val view = binding.root
binding.btn.setOnClickListener {
binding.myTextView.text = "こんにちは"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment