textView.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence chars, int arg1, int arg2,
int arg3) {
}
@Override
public void beforeTextChanged(CharSequence chars, int arg1,
int arg2, int arg3) {
}
@Override
public void afterTextChanged(Editable editable) {
if (editable != null
&& !editable.toString().toUpperCase(Locale.CHINA)
.equals(editable.toString())) {
textView.setText(editable.toString().toUpperCase(
Locale.CHINA));
}
Spannable t = editable;
Selection.setSelection(t, editable.toString().length());
}
});