I'm searching for a way to prevent the user from moving the cursor position anywhere. The cursor should always stay at the end of the current EditText value. In addition to that the user should not be able to select anything in the EditText. Do you have any idea how to realize that in Android using an EditText?
To clarify: the user should be able to insert text, but only at the end.
I had the same problem. This ended up working for me:
public class CustomEditText extends EditText {
@Override
public void onSelectionChanged(int start, int end) {
CharSequence text = getText();
if (text != null) {
if (start != text.length() || end != text.length()) {
setSelection(text.length(), text.length());
return;
}
}
super.onSelectionChanged(start, end);
}
}