I am new to Kotlin. Among other very interesting things, I found Android extensions that , according to the documentation , should allow me to use activities without having to findViewById .
This actually works very well, adding only this line to my import:
import kotlinx.android.synthetic.main.<layout>.*
The problem is that two different layouts contain a widget with the same identifier (i.e. the same name for the synthetic property),
for example two different TextView with id txtTitle . Let's say the first one relates to activity, and the second one refers to the layout used inside the adapter.
When I try to call a method in the first TextView (one of the actions), I do not see the expected result, as if the call was made on a different view. As a confirmation of this, when I call txtTitle.parent , I see the parent and siblings of another txtTitle , not the expected ones.
Am I doing something wrong? The only ways I found to get around this problem is to use different names in all my layouts or to continue to use findViewById , but it would be very unfortunate to waste this language function ...
source share