user2351509
user2351509

Reputation: 51

Set cursor position in Edit Text android

How can i set the cursor position in android edit text? Im making a button which would make the cursor one character forward ie. an arrow key like

Upvotes: 1

Views: 2357

Answers (2)

Aj 27
Aj 27

Reputation: 2427

You can length of the string entered in edit text.

editText.setSelection(editText.getText().length());

Upvotes: 3

Parin Parikh
Parin Parikh

Reputation: 785

You have to use setSelection(int position) method of edittext. Like edt.setSelection(0)

Upvotes: 1

Related Questions