Last active
October 7, 2015 19:07
-
-
Save danielsotopino/eae7587842d355cdbc74 to your computer and use it in GitHub Desktop.
[Android] Replace EditText text on user input.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
editText.addTextChangedListener(new TextWatcher() { | |
@Override | |
public void onTextChanged(CharSequence s, int start, | |
int before, int count) { | |
} | |
@Override | |
public void beforeTextChanged(CharSequence s, int start, | |
int count, int after) { | |
} | |
@Override | |
public void afterTextChanged(Editable s) { | |
idAnswerEditText.removeTextChangedListener(this); | |
String someString = StringUtil.doSomething(s.toString()); | |
idAnswerEditText.getText().clear(); | |
idAnswerEditText.getText().append(someString); | |
idAnswerEditText.setSelection(someString.length()); | |
idAnswerEditText.addTextChangedListener(this); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment