at my project i get this problem
what is solution
Kotlin is usually good at allowing you to call properties defined in Java using the getName/setName convention in Kotlin using the property syntax of “.name”.
However TextView (which is the superclass of EditText) defines overloads of setText so the type has these methods:
getText() setText(int resid) setText(CharSequence text) setText(CharSequence text, TextView.BufferType type) setText(int resid, TextView.BufferType type) setText(char text, int start, int len)
With all these variations on setText Kotlin doesn’t think that text is a standard Java property and doesn’t allow you to access it as “.text” and you have to fall back to calling getText and setText methods.
Some Kotlin libraries may help work around this by defining alternately named extension properties, but in this case you will probably just need to use getText and setText methods.
how can i use this
i try instead text do gettext and set text but no solution good
So the first error line replace “.text” with “.getText()”. The other line you replace “.text = value” with “.setText(value)”
The problem is an import problem. Look carefully and you will see that etUserYearOfBirth is a resource Id. Because you are importing all resource Id’s into the namespace this will be resolved as a resourceId (integer).
What you probably intended to do was to use the Kotlin android extensions instead. You will have to make sure that they are enabled in your gradle file and remove the import of the id constants (this import is probably problematic, you should normally use R.id.* explicitly to avoid exactly the problem you’re having now).
sorry friend iam new in this field can u explain for me step by step …
The linked article provides instructions in quite some detail. You should attempt to follow them. In short however do the following: