set EditText Selection To End - Android User Interface

Android examples for User Interface:EditText

Description

set EditText Selection To End

Demo Code


//package com.java2s;
import android.text.Editable;
import android.text.Selection;
import android.text.Spannable;

import android.widget.EditText;

public class Main {

    public static final void setEditTextSelectionToEnd(EditText editText) {
        Editable editable = editText.getEditableText();
        Selection.setSelection((Spannable) editable, editable.toString()
                .length());/*  ww  w  .  j ava  2s.c om*/
    }
}

Related Tutorials