Reputation: 310
afterTextChanged is triggered for each character of the string if I change the contents of the EditText programmatically. Shouldn't editText.setText("abc") just trigger the listener once instead of 3 times?
Upvotes: 0
Views: 200
Reputation: 91
to detect if the user change the text or changed programmatically you can use the setTag() function for ex:
eddittext.setTag( "programmatically" );
eddittext.setText( "your text" );
eddittext.setTag(null);
//-----------------------------
@Override public void afterTextChanged(Editable s) {
if( eddittext.getTag() == null )
// Value changed by user
else
// changed programmatically
}
Upvotes: 2