How to make TextWatcher wait for some time before doing some action

后端 未结 2 1406
滥情空心
滥情空心 2021-02-08 12:16

I have an EditText to filter the items in the ListView below it, which may contain more than 1000 items usually. The TextWatcher is:

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-08 13:10

    Using RxBinding :

    RxTextView.textChanges(edittext)
                .skipInitialValue()
                .debounce(TIME_TO_WAIT, TimeUnit.MILLISECONDS)
                .subscribe({
                   //do the thing
                })
    }
    

提交回复
热议问题