I have an EditText View which is edited by setText() from my code and by the user via (soft/hard) keyboard and - if possible by speech input. I wan
I was having this issue when rotating the device. My editText is inside a dialog. Here's how I solved it:
editText.addTextChangedListener(
new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
String newValue = s.toString();
String oldValue = (String) editText.getTag();
if (newValue.length() > 0) {
editText.setTag(newValue);
}
boolean itReallyChanged = oldValue != null && !newValue.equals(oldValue) && !newValue.isEmpty();
if (itReallyChanged) {
// Pretty sure the user genuinely changed this value,
// not the device rotation
}
}
}
);