Using a SearchView
in my application.
Is there anyway in which I can make the call to onQueryTextChange() method delayed. Like, when user type a sequence o
You can use Kotlin coroutines like this. Declare the countdown job
private lateinit var textChangeCountDownJob: Job
And then onQueryTextChange:
override fun onQueryTextChange(newText: String): Boolean {
if(::textChangeCountDownJob.isInitialized)
textChangeCountDownJob.cancel()
textChangeCountDownJob = launch(UI) {
delay(800)
}
return false
}