Home » Android » android – How to get cursor position in a Edittext

android – How to get cursor position in a Edittext

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am making an Android application. In my application, I have to find the cursor position of a edittext. For example, I put the text "how are you" on edittext. If I click next to character 'a' then, I have to find the cursor now in front of ‘a’.

How can I find out the cursor position and the character where cursor is placed?

How to&Answers:

Use getSelectionStart() method to get current position of cursor in an Edittext