Android TextWatcher for more than one EditText

Posted by Creative MITian on Stack Overflow See other posts from Stack Overflow or by Creative MITian
Published on 2010-11-26T06:43:07Z Indexed on 2011/01/14 12:53 UTC
Read the original article Hit count: 116

I want to implement the TextWatcher interface for more than one EditText fields. Currently I am using :

text1.addTextChangedListener(this);
text2.addTextChangedListener(this);

then overriding the methods in my Activity:

public void afterTextChanged(Editable s) {}

public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) 
{
 // do some operation on text of text1 field
 // do some operation on text of text2 field 
}

However this is working fine but I'm looking for other ways so that I can explicitly identify that in which EditText field the SoftKeyboard is currently focused.

© Stack Overflow or respective owner

Related posts about android

Related posts about interface