Get string Value from Editable - Android android.text

Android examples for android.text:Editable

Description

Get string Value from Editable

Demo Code

import android.text.Editable;
import android.widget.EditText;

public class Main{

    static public String stringValueFor(Editable editable) {
        char[] cs = new char[editable.length()];
        editable.getChars(0, editable.length(), cs, 0);
        return new String(cs);
    }//from  w ww. ja  v a  2 s . c o  m
    static public String stringValueFor(EditText editable) {
        return stringValueFor(editable.getText());
    }

}

Related Tutorials