I'm using these extensions and everything works great, but I've noticed that sometimes does not perform the bind correctly, in modules such as Adapters, ViewHolders and this time in a DialogFragment. This exception is throwing me:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
I have the "1.1.4-2" version of Kotlin In the import I have my layout:
import kotlinx.android.synthetic.main.layout_dialog_scan.*
and in the onCreateView method:
val viewRoot = inflater!!.inflate(R.layout.layout_dialog_scan, container, false)
img_close.setOnClickListener{ hideViews() }
edit_code.addTextChangedListener(this)
//.....Más widgets
return viewRoot
This error disappears if I perform the bind based on the view:
val imageView = viewRoot.findViewById<ImageView>(R.id.img_close)
imageView.setOnClickListener{ hideViews() }
Does anyone know the possible cause of the error?