How to set cursor position in EditText?
Where position is an int:
editText1.setSelection(position)
I have done this way to set cursor position to end of the text after updating the text of EditText programmatically
here, etmsg
is EditText
etmsg.setText("Updated Text From another Activity");
int position = etmsg.length();
Editable etext = etmsg.getText();
Selection.setSelection(etext, position);