set EditText Text - Android User Interface

Android examples for User Interface:EditText

Description

set EditText Text

Demo Code


//package com.java2s;

import android.text.TextUtils;

import android.widget.EditText;

public class Main {

    public static void setText(EditText editText, String text) {
        if (null != editText && !TextUtils.isEmpty(text)) {
            editText.setText(text);//  w  ww. j a v a2 s  .  c om
            editText.setSelection(text.length());
        }
    }
}

Related Tutorials