I am new in kotlin. I have found and tried to use synthetic method instead of annoying method findViewById
in my Activity
class, but I have found \
It means you have to place this line at the beginning of your source file:
import kotlinx.android.synthetic.main.view.*
So now instead of, for example, findView(R.id.textView) as TextView
you would write just textView
. The latter is a synthetic extension property located in the package kotlinx.android.synthetic.main.view
, that's why you have to import everything from it.
There's a tutorial on the official site, take a look.