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 boolean isEditTextEmpty(EditText eText) {
    return eText != null && !isEmpty(eText.getText().toString());
}

From source file:Main.java

public static boolean validarCamposVazios(EditText... editTexts) {
    boolean isValido = true;
    for (EditText editText : editTexts) {
        if (editText.getText().toString().isEmpty()) {
            isValido = false;// w w w.j  a v  a 2 s .c  o m
        } else {
            editText.setError(null);
        }
    }
    return isValido;
}

From source file:Main.java

public static boolean isEmptys(EditText... editTexts) {
    for (EditText ed : editTexts) {
        String str = ed.getText().toString().trim();
        if (TextUtils.isEmpty(str)) {
            return true;
        }//from  w  w w. java2 s  . co m
    }
    return false;
}

From source file:Main.java

/**
 * check if an EditText is empty, and returns a boolean
 * @param editTexts//  w w w  .j ava  2  s.  c om
 * @return
 */
public static boolean isEmptyMultiEditText(EditText... editTexts) {
    for (EditText editText : editTexts) {
        if (editText.getText().toString().trim().length() == 0) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

public static void incrementEditText(EditText et) {
    String current = et.getText().toString();
    if (current.length() == 0) {
        et.setText("1");
    }/*from w  ww.j a  v a2s  .c  o  m*/
    double doubleValue = Double.valueOf(et.getText().toString());
    int intValue = (int) doubleValue;
    if (doubleValue == intValue) {
        String incremented = String.valueOf(intValue + 1);
        et.setText(incremented);
    } else {
        String incremented = String.valueOf(doubleValue + 1d);
        et.setText(incremented);
    }
    et.clearFocus();
}

From source file:Main.java

private static boolean emailValido(EditText email) {
    boolean Valido = true;
    if (email.getText().toString().contains("@") == true) {
        return email.getText().toString().contains(".");
    }//from  w  w  w. ja  va 2 s.  c  o m
    return Valido = false;
}

From source file:Main.java

public static String getText(Activity activity, int id) {
    EditText et = (EditText) activity.findViewById(id);
    return et.getText().toString();
}

From source file:Main.java

public static boolean isEmpty(EditText... editTexts) {
    for (EditText editText : editTexts) {
        String content = editText.getText().toString().trim();
        if (content == null || content.length() == 0) {
            return true;
        }/*ww  w  .j  a  va  2s .  co  m*/
    }
    return false;
}

From source file:Main.java

public static boolean checkAlphabetic(EditText editText) {
    String pattern = "[a-zA-Z ]";
    return (editText.getText().toString().matches(pattern)) ? true : false;
}

From source file:Main.java

public static String getContent(EditText editText) {
    if (editText != null) {
        return editText.getText().toString().trim();
    }//ww w.j  a  v  a2 s. c o  m
    return null;
}