I know this question has been asked many times over but I can't get any of the solutions to work.
I am implementing a TextWatcher
and I want to make a network request but only when the user has finished typing.
Here is my code.
val StartFragment.textWatcher: TextWatcher
get() = object : TextWatcher {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
searchPlaces(s)
}
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
}
How do I wait to find out if the user is not typing anymore before performing searchPlaces(s)
.