Следующий ответ может помочь вам. Он отлично работает для меня
Чтобы вставить текст / символ в выбранную позицию курсора EditText
int start = edtPhoneNo.getSelectionStart(); //this is to get the cursor position
String s="sagar";//s="0123456789";
edtPhoneNo.getText().insert(start, s);
//this is to set the cursor position by +1 after inserting char/text
edtPhoneNo.setSelection(start + 1);
Удалить текст / символ ввыбранная позиция EditText
курсор
int curPostion = edtPhoneNo.getSelectionEnd();
SpannableStringBuilder selectedStr = new
SpannableStringBuilder(edtPhoneNo.getText());
selectedStr.replace(curPostion - 1, curPostion, "");
edtPhoneNo.setText(selectedStr);
//this is to set the cursor position by -1 after deleting char/text
edtPhoneNo.setSelection(curPostion - 1);
Для установки EditText
курсор на последнюю позицию
edtPhoneNo.setSelection(edtPhoneNo.getText().length());
Это код XML для EditText
<EditText
android:id="@+id/edtPhoneNumber"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:focusable="true"
android:focusableInTouchMode="true"
android:maxLines="1" />