Hi, quick question does anyone know how to use ext...
# android
m
Hi, quick question does anyone know how to use extensions to reference a view included in another view (include) ? am getting IllegalStateException.
m
Can you be more specific?
m
let say i have my view which includes another view using (include tag). Now if you want to reference any view inside your layout you can do that by importing your layout ex.
Copy code
import kotlinx.android.synthetic.main.activity_login.*
and this is fine. But, if you want to reference a view inside the included view you get NullPointerException.
n
<include> ’ed?
m
yes
n
import kotlinx.android.synthetic.main.common_view.*
so import both views
m
that's not working it's giving me NullPointerException
m
If it is activity then It means that one of this views is not shown
findViewById(id)
returns null
l
Did you set id to your include tag?
m
yes