You can get the Cursor position using the getSelectionStart() and getSelectionEnd() methods. If no text is highlighted, both getSelectionStart() and getSelectionEnd() return the position of the cursor. myEditText . getSelectionStart (); or myEditText . getSelectionEnd (); How to insert text at cursor position. int curPos = editText .getSelectionStart(); String str = editText .getText().toString(); String str1 = (String) str.substring(0, curPos); String str2 = (String) str.substring(curPos); editText .setText(str1+ "<br/>" + list1 [which] +str2);
Blog completely focused on android question-answer.