I have EditText which displays something like ###-###. I want the user to be able to change this text only from the 1st position onward. That is user should not be able to touch
Following code will force the curser to stay in last position if the user tries to move it with a tap on the edittext:
edittext.setCursorVisible(false);
edittext.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
edittext.setSelection(edittext.getText().length());
}
});
Note that the user can still change the position of the curser via arrow keys and / or trackball. As far as I know there is currently no workaround for this issue.