Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get cursor position in a Edittext [duplicate]

Tags:

android

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?

like image 464
sarath Avatar asked Mar 21 '12 05:03

sarath


1 Answers

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

like image 145
Yugandhar Babu Avatar answered Oct 13 '22 18:10

Yugandhar Babu