Reputation: 511
Is there any way to notify the EditText
that the text has changed when I do an EditText.setText("blablabla");
I have a SimpleTextChangeListener
attached to this EditText
and I want this to trigger when I do a setText
on the EditText
.
Is there any way I can achieve this?
Upvotes: 0
Views: 1356
Reputation: 6405
You can use TextWatcher to trigger any action on EditText.setText("blablabla");
If you setText
to your EditText
, onTextChanged()
method will be called. Then you can trigger your desired action there.
editText.addTextChangedListener(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) {
// Trigger on setText
}
@Override
public void afterTextChanged(Editable s) {}
});
Hope this helps.
Upvotes: 1