set Cursor To End in EditText - Android android.widget

Android examples for android.widget:EditText

Description

set Cursor To End in EditText

Demo Code

import android.widget.EditText;

public class Main {

  public static void setCursorToEnd(EditText editText) {
    if (editText != null) {
      CharSequence text = editText.getText();
      int cursorPos = text.length();
      editText.setSelection(cursorPos, cursorPos);
    }/*from ww w  .  j  a  va2s. c  om*/
  }

}

Related Tutorials