Android TextWatcher for more than one EditText
- by Creative MITian
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.