Example usage for android.text TextUtils isEmpty

List of usage examples for android.text TextUtils isEmpty

Introduction

In this page you can find the example usage for android.text TextUtils isEmpty.

Prototype

public static boolean isEmpty(@Nullable CharSequence str) 

Source Link

Document

Returns true if the string is null or 0-length.

Usage

From source file:Main.java

private static boolean isAllNum(String str) {
    if (!TextUtils.isEmpty(str)) {
        try {//from  w  ww  . ja v  a 2 s.  c o m
            Integer.valueOf(str);
            return true;
        } catch (Exception e) {

        }
    }

    return false;
}

From source file:Main.java

public static boolean isValidResponse(String mResponse) {
    if (TextUtils.isEmpty(mResponse)) {
        return false;
    }/* www .j  a v a  2s  . c o m*/
    return mResponse.startsWith("Plays: <a") || mResponse.startsWith("{\"html\":\"Plays:")
            || mResponse.startsWith("{\"playid\":");
}

From source file:Main.java

public final static boolean isNotEmpty(CharSequence target) {
    return !TextUtils.isEmpty(target);
}

From source file:Main.java

public static String getWifiSsid(String wifiInfo) {
    if (TextUtils.isEmpty(wifiInfo)) {
        return "No Wifi Name";
    }//from w  w  w .j a v  a  2s .  c  om
    int len = wifiInfo.length();
    if (wifiInfo.startsWith("\"") && wifiInfo.endsWith("\"")) {
        wifiInfo = wifiInfo.substring(1, len - 1);
    }
    return wifiInfo;
}

From source file:Main.java

public static String verifiedPersonalInfo(String personalInfo) {
    if (TextUtils.isEmpty(personalInfo))
        return null;
    return personalInfo.substring(0, 1).toUpperCase() + personalInfo.substring(1);
}

From source file:Main.java

public static boolean isImage(String filePath) {
    if (TextUtils.isEmpty(filePath)) {
        return false;
    }//from  www. j  a va2  s. c  om

    filePath = filePath.toLowerCase();
    if ((!filePath.endsWith(".jpg") && !filePath.endsWith(".jpeg") && !filePath.endsWith(".png")
            && !filePath.endsWith(".bmp") && !filePath.endsWith(".gif"))) {
        return false;
    }
    return true;
}

From source file:Main.java

protected static boolean checkIsWIFINetType(String ssid) {
    if (TextUtils.isEmpty(ssid) || "CMCC".equals(ssid) || "ChinaNet".equals(ssid)
            || "ChinaUnicom".equals(ssid)) {
        return true;
    }//ww  w . j  a  v  a2 s.  c o m
    return false;
}

From source file:Main.java

public static boolean isMacEqual(String mac1, String mac2) {
    if (!TextUtils.isEmpty(mac1) && !TextUtils.isEmpty(mac2)) {
        return mac1.replace(":", "").toUpperCase().equals(mac2.replace(":", "").toUpperCase());
    }/*from ww w  . ja v a2  s  .  c  o  m*/
    return false;
}

From source file:Main.java

public final static boolean isValidEmail(CharSequence target) {
    return !TextUtils.isEmpty(target) && android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
}

From source file:Main.java

public static String checkMucVerifyDomain(String domain) {
    if (!TextUtils.isEmpty(domain) && !domain.startsWith("@")) {
        return "@" + domain;
    }//  w  w w . j a  v a2  s  .com
    return domain;
}