I have an EditText
field in my application and have a TextWatcher
associated with it. The afterTextChanged()
event callback gets invoked even when the user does not tap on the EditText
to edit it. I need to check if the user has edited the EditText or not and with the current code it always calls the afterTextChanged()
method when I load the activity.
//TextWatcher
textwatcher_timestamp = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
String updatedText = s.toString();
Log.v(TAG, updatedText);
}
};
//Edit Text
timestampereadback_text.addTextChangedListener(textwatcher_timestamp);