val titlewatcher = object : TextWatcher{}
Why exactly is the word object used here. A quick search in android developer site says -object declares a singleton. So why is it used here?
val titlewatcher = object : TextWatcher{}
Why exactly is the word object used here. A quick search in android developer site says -object declares a singleton. So why is it used here?
Okay…so TextWatcher is an interface, and interface is a subclass of Object? I’ll go with that unless someone can add more.
It allows us to make a one time object of the given class/interface through an object expression. See https://kotlinlang.org/docs/reference/object-declarations.html for more details.
ahhh. object is single instance. got it! thanks.