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

public static boolean isHtml(String str) {
    if (!TextUtils.isEmpty(str)) {
        return str.contains("<html");
    }//from www. j a v  a 2s  .  c o  m
    return false;
}

From source file:Main.java

public static boolean isMx3Phone() {
    String model = android.os.Build.MODEL;
    if (!TextUtils.isEmpty(model)) {
        return model.equals("M351");
    }/* w  ww.java  2 s  .c  om*/
    return false;
}

From source file:Main.java

public static boolean isGifPicture(String url) {
    return !TextUtils.isEmpty(url) && url.endsWith(".gif");
}

From source file:Main.java

private static void deleteFlie(String path) {
    if (TextUtils.isEmpty(path)) {
        return;//  w ww  . ja v a 2  s  . c o  m
    }
    File filePath = new File(path);
    File[] itemList = filePath.listFiles();
    long totalSize = 0;
    if (null != itemList) {
        for (File f : itemList) {
            if (f.exists() && f.isFile()) {
                f.delete();
            }
        }
    }
}

From source file:Main.java

public static boolean isStatusOk(String status) {
    return TextUtils.isEmpty(status) || "ok".equalsIgnoreCase(status);
}

From source file:Main.java

public static boolean str2Bool(String obj, Boolean defValue) {
    try {//from   w  w  w  .  j a v  a2s. c o m
        if (TextUtils.isEmpty(obj))
            return defValue;
        return Boolean.parseBoolean(obj);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return defValue;
}

From source file:Main.java

public static String[] convertRefer(String refer) {
    return TextUtils.isEmpty(refer) ? null : refer.split(",");
}

From source file:Main.java

public static boolean isEmailValid(String email) {
    if (TextUtils.isEmpty(email))
        return false;

    String regex = "^([a-z0-9_\\.-]{1,50})@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$";
    return Pattern.matches(regex, email);
}

From source file:Main.java

public static boolean isNotBlank(String str) {
    return !TextUtils.isEmpty(str) && !TextUtils.isEmpty(str.trim());
}

From source file:Main.java

private static long getFileSize(String path) {
    if (TextUtils.isEmpty(path)) {
        return 0;
    }/*  w  w w  . j a  va  2  s.co  m*/
    File filePath = new File(path);
    File[] itemList = filePath.listFiles();
    long totalSize = 0;
    if (null != itemList) {
        for (File f : itemList) {
            if (f.exists() && f.isFile() && f.length() > 0) {
                totalSize = totalSize + f.length();
            }
        }
    }
    return totalSize;
}