Implementing Text Watcher for EditText

前端 未结 4 1196
北海茫月
北海茫月 2020-11-27 07:20

I have an EditText. When i click on it, it becomes focusable. I will type the input text to be entered into the EditText. I want to implement a listener for EditText, so tha

4条回答
  •  情书的邮戳
    2020-11-27 07:22

    Also you can use debounce operator of Rx java.

    subject.debounce(300, TimeUnit.MILLISECONDS)
                        .subscribeOn(Schedulers.io())
                        .observeOn(AndroidSchedulers.mainThread())
                        .map(yourString -> {
                               // save to db
                            }
                            return "";
                        })
                        .subscribe()
    

    Here you can define time limit , after how much time you want it to get saved in db.

提交回复
热议问题