https://kotlinlang.org logo
#android
Title
# android
k

kartikpatodi

06/06/2018, 7:37 PM
loginBtn.setOnClickListener(this) here
loginBtn
is from the xml via android extentions
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setOnClickListener(android.view.View$OnClickListener)' on a null object
r

rkeazor

06/06/2018, 7:47 PM
Where are you doing this at? I believe this happens when you call it to early,
k

kartikpatodi

06/06/2018, 7:48 PM
on the onCreateView of the Fragment
r

rkeazor

06/06/2018, 7:48 PM
yea thats to early
k

kartikpatodi

06/06/2018, 7:49 PM
so where to set it
r

rkeazor

06/06/2018, 7:49 PM
The view needs to already be created
onViewCreated
try that
k

kartikpatodi

06/06/2018, 7:49 PM
okay
It worked!! Thanks a ton
r

rkeazor

06/06/2018, 8:02 PM
no prob dude