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 checkFieldsEmpty(EditText... editTexts) {
    for (EditText editText : editTexts) {
        if (TextUtils.isEmpty(editText.getText())) {
            return true;
        }/* w w  w .j  a  va 2  s .c om*/
    }
    return false;
}

From source file:Main.java

public static boolean checkFieldFull(EditText... editTexts) {
    for (EditText editText : editTexts) {
        if (!TextUtils.isEmpty(editText.getText())) {
            return true;
        }/*from w w w.j  a  va2 s  .c  o m*/
    }
    return false;
}

From source file:Main.java

public static boolean isValidIdCard(EditText paramEditText) {
    return (paramEditText != null) && (isValidIdCard(paramEditText.getText().toString()));
}

From source file:Main.java

public static boolean hasLength(EditText editText) {
    // text never null!
    String str = editText.getText().toString();
    if (!TextUtils.isEmpty(str)) {
        return str.trim().length() > 0;
    } else {//from w w w.  jav a2  s.co m
        return false;
    }
}

From source file:Main.java

public static boolean checkAllEditTexts(EditText... editTexts) {
    for (EditText edit : editTexts) {
        if (edit == null || !(edit.getText().toString().trim().length() > 0)) {
            return NO;
        }//ww  w .  ja va  2  s.  co m
    }
    return YES;
}

From source file:Main.java

/**
 * Get the text from an edit text.//from   w  ww.  jav a 2  s.  co m
 * @param edit edit text to extract text from
 * @return text extracted from the edit text
 */
public static String getEditText(EditText edit) {
    String returnText;
    try {
        returnText = edit.getText().toString();
    } catch (NullPointerException ex) {
        returnText = "";
    }
    return returnText;
}

From source file:Main.java

public static boolean EmailPassNickCheck(EditText email, EditText password, EditText nick) {
    if (nick != null) {
        if (nick.getText().toString().trim().equals("")) {
            nick.setError("Empty name please revise!");
            return false;
        }/*from  w w w .j  a  v a 2  s .co  m*/
    } else if (email.getText().toString().trim().equals("")) {
        email.setError("Empty email please revise!");
        return false;
    } else if (password.getText().toString().trim().equals("")) {
        password.setError("Empty password please revise!");
        return false;
    } else if (!EmailValidation(email)) {
        email.setError("Incorrect Email please revise!");
        return false;
    }
    return true;
}

From source file:Main.java

public static boolean nonEmpty(EditText editText) {
    if (editText != null && !(TextUtils.isEmpty(editText.getText().toString().trim()))) {
        return YES;
    } else {/*ww w.j  av a  2s . c om*/
        Log.d("SERI_PAR->Error", "edit text object is null");
        return NO;
    }
}

From source file:Main.java

public static boolean isValidAadharNumber(EditText aadhar) {

    boolean flag = false;

    if (aadhar != null && aadhar.getText().toString().length() == 12) {

        flag = true;/*ww  w .  j av  a  2 s  .com*/

    } else {

        flag = false;

    }

    return flag;
}

From source file:Main.java

public static void insert(EditText input, CharSequence text) {
    int iCursorStart = Selection.getSelectionStart((input.getText()));
    int iCursorEnd = Selection.getSelectionEnd((input.getText()));
    if (iCursorStart != iCursorEnd) {
        ((Editable) input.getText()).replace(iCursorStart, iCursorEnd, "");
    }/* w  w w .j  av  a  2 s .  c om*/
    int iCursor = Selection.getSelectionEnd((input.getText()));
    ((Editable) input.getText()).insert(iCursor, text);
}