oscarg798
07/14/2017, 1:32 AMvivekneel
07/14/2017, 4:25 AMmarstran
07/14/2017, 7:06 AMlet
is defined for all objects. Even nullable ones.joachim.reiss.
07/14/2017, 7:23 AMtokajip
07/14/2017, 7:53 AMapply
and it’ll as simple as text=..
marstran
07/14/2017, 8:01 AMmTextview.apply { text = myString }
@tokajip ? In that case, you lose the null-check on myString
.tokajip
07/14/2017, 8:20 AMmTextView?.apply { text = myString }
you’ll have null-check on myString
and save the myString
or it
inside the functionmarstran
07/14/2017, 8:30 AMmTextView
which isn't nullable. myString
can still be null.tokajip
07/14/2017, 8:40 AMTextView
on called ?.let{ }
but as I looked again, I saw its a String
But on Android you can set null for a TextView
text
property, because the system’ll transform it to an empty String
marstran
07/14/2017, 10:39 AMmyString
is null.