开发者

notification after an EditText has been modified?

开发者 https://www.devze.com 2023-03-28 04:54 出处:网络
setOnKeyListener and setFilters notify me before the key/characere is added to the EditText. I would like to be notified after the character has been added to the EditText.

setOnKeyListener and setFilters notify me before the key/characere is added to the EditText.

I would like to be notified after the character has been added to the EditText.

One approach I can think of is to override the EditText's on开发者_JS百科Draw but I would like to know if there is a better approache.

TIA


Use addTextChangedListener(TextWatcher watcher)

Adds a TextWatcher to the list of those whose methods are called whenever this TextView's text changes.

Android TextView


Take a look at TextWatcher

http://developer.android.com/reference/android/text/TextWatcher.html


Set TextWatcher interface to the EditText.
TextWatcher has afterTextChanged() method.


use textwatcher:

http://developer.android.com/reference/android/text/TextWatcher.html


Use TextWatcher as all friend suggest you and override below method

  public abstract void afterTextChanged (Editable s){
//Create Notification here by using notification manager
}
0

精彩评论

暂无评论...
验证码 换一张
取 消