I want to get View's text. So I check that view was TextView, and used v.text
.
In this situation, v.text
is Charsequence!
. and I try to change v.text
to String. I got two situation, v.text.toString
and v.text as String
. What are they difference?
override fun onClick(v: View?) {
when(v) {
is TextView -> {
Log.d("v.text", v.text)
// v.text is Charsequence but msg need String
}
}
}