How to set cursor position in EditText?

nila picture nila · Nov 7, 2011 · Viewed 230.7k times · Source

There are two EditText,while loading the page a text is set in the first EditText, So now cursor will be in the starting place of EditText, I want to set cursor position in the second EditText which contains no data. How to do this?

Answer

NotACleverMan picture NotACleverMan · Nov 7, 2011

Where position is an int:

editText1.setSelection(position)