Quick quesiton, so `findViewById` is no longer nec...
# announcements
d
Quick quesiton, so
findViewById
is no longer necessary,
Copy code
val btnSaveClick= findViewById<Button>(R.id.btnSave)
      btnSaveClick?.setOnClickListener {
          Toast.makeText(this@ArticleAdapter, "Article saved.", Toast.LENGTH_LONG).show()
      }
What should be used instead
k
#C0B8M7BUY, but I think if you start typing
btnSave
AS will suggest to just import it, which is a bit of compiler magic.
And you can reply in threads 😉
d
So instead of
indViewById<Button>(R.id.btnSave)
type
btnSave
and should suggest the import where I have the button defined?
k
Provided you have this stuff set up of course: https://kotlinlang.org/docs/tutorials/android-plugin.html
d
I do indeed