Example usage for android.widget EditText getText

List of usage examples for android.widget EditText getText

Introduction

In this page you can find the example usage for android.widget EditText getText.

Prototype

@Override
    public Editable getText() 

Source Link

Usage

From source file:Main.java

public static String getEditViewText(View view, int textId) {
    EditText editText = (EditText) view.findViewById(textId);
    return editText.getText().toString();
}

From source file:Main.java

public static boolean isEmptyTextEditText(EditText editText) {
    boolean isEmpty = true;

    if (editText.getText() != null && editText.getText().toString() != null
            && !"".equals(editText.getText().toString().trim())) {
        isEmpty = false;/*  w ww . j ava 2  s.co m*/
    }

    return isEmpty;
}

From source file:Main.java

public static boolean checkNumeric(EditText editText) {
    String mobilePattern = "[0-9]";
    return (!editText.getText().toString().matches(mobilePattern)) ? true : false;
}

From source file:Main.java

/**
 * Gets text from an editText, checks if it is valid, trims it, and if it is not = null,
 * returns a boolean of true/ false//w w  w .  ja va 2  s.  c  o  m
 * @param et
 * @return
 */
public static boolean isFieldValid(EditText et) {
    String str = et.getText().toString();
    if (!str.equals(null)) {
        str = str.trim();
        if (!str.equalsIgnoreCase("")) {
            if (!str.isEmpty()) {
                return true;
            }
        }
    }
    return false;
}

From source file:Main.java

public static String getEditText(View view, int editId) {
    EditText editText = (EditText) view.findViewById(editId);

    return editText.getText().toString();
}

From source file:Main.java

public static String get_editText_string(Activity activity, int what) {
    EditText ans = (EditText) activity.findViewById(what);
    String str = ans.getText().toString();
    return str;/*  ww  w  . ja va 2s  .  c  o m*/
}

From source file:com.berniesanders.fieldthebern.parsing.FormValidator.java

public static boolean isNullOrBlank(EditText editText) {
    return (editText.getText() == null || isBlank(editText.getText().toString()));
}

From source file:Main.java

public static int parseInt(EditText editText, int defaultValueIfInputIsEmpty) {
    String inputText = editText.getText().toString();
    return "".equals(inputText) ? defaultValueIfInputIsEmpty : Integer.parseInt(inputText);
}

From source file:Main.java

public static void putCursorAfterLastSymbol(EditText... editTexts) {
    for (EditText editText : editTexts) {
        editText.setSelection(editText.getText().length());
    }//from ww w.  j  a v  a  2  s. co m
}

From source file:Main.java

public static boolean IsFormCompleted(ViewGroup v) {
    for (int i = 0; i < v.getChildCount(); i++) {
        Object child = v.getChildAt(i);

        if (child instanceof EditText) {
            EditText e = (EditText) child;

            if (e.getText().length() == 0)
                return false;
        } else if (child instanceof RadioGroup) {
            RadioGroup rb = (RadioGroup) child;

            if (rb.getCheckedRadioButtonId() < 0)
                return false;
        }//  ww  w .j  a  v  a  2s  .c om
    }

    return true;
}