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 doesExisted(String filepath) {
    if (TextUtils.isEmpty(filepath)) {
        return false;
    }//from   w w  w  .  j  a  v  a  2  s. co  m

    return doesExisted(new File(filepath));
}

From source file:Main.java

public static boolean checkRegParams(String nick, String password, String qq) {
    if (!TextUtils.isEmpty(nick) && !TextUtils.isEmpty(password) && !TextUtils.isEmpty(qq)
            && TextUtils.isDigitsOnly(qq)) {
        return true;
    } else {//from www . ja v a 2 s  .co  m
        return false;
    }
}

From source file:Main.java

public static boolean deleteFile(String filePath) {
    if (TextUtils.isEmpty(filePath)) {
        return false;
    }/* www  . j a  va2  s.c o  m*/
    File file = new File(filePath);
    if (file.exists()) {
        return file.delete();
    }
    return false;
}

From source file:Main.java

public static boolean isVideoFile(String suffix) {
    if (TextUtils.isEmpty(suffix)) {
        return false;
    }/*from   w w w.  j  a va2  s .  co m*/
    if (suffix.startsWith(".")) {
        suffix = suffix.substring(1);
    }
    String videoFormat[] = new String[] { "MP4", "3GP" };
    for (int i = 0; i < videoFormat.length; i++) {
        if (suffix.equalsIgnoreCase(videoFormat[i])) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

public static boolean isAudioFile(String suffix) {
    if (TextUtils.isEmpty(suffix)) {
        return false;
    }/* w  w  w .  j a  v  a  2  s. c o  m*/
    if (suffix.startsWith(".")) {
        suffix = suffix.substring(1);
    }
    String audioFormat[] = new String[] { "AMR" };
    for (int i = 0; i < audioFormat.length; i++) {
        if (suffix.equalsIgnoreCase(audioFormat[i])) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

public static boolean isImageFile(String suffix) {
    if (TextUtils.isEmpty(suffix)) {
        return false;
    }/*from www .j  a v  a2 s.c o  m*/
    if (suffix.startsWith(".")) {
        suffix = suffix.substring(1);
    }
    String imageFormat[] = new String[] { "JPEG", "JPG", "BMP", "PNG" };
    for (int i = 0; i < imageFormat.length; i++) {
        if (suffix.equalsIgnoreCase(imageFormat[i])) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

private static String escapeWifiName(String wifiName) {
    if (TextUtils.isEmpty(wifiName))
        return "";
    if (Build.VERSION.SDK_INT >= 17 && wifiName.startsWith("\"") && wifiName.endsWith("\"")) {
        wifiName = wifiName.substring(1, wifiName.length() - 1);
    }//  w w w.  j a v a 2  s. com
    return wifiName;
}

From source file:Main.java

public static boolean chechField(String string) {
    return TextUtils.isEmpty(string);
}

From source file:Main.java

public static boolean isVailUrl(String url) {
    if (TextUtils.isEmpty(url)) {
        return false;
    }/*from ww  w  .j a va2 s .c om*/
    return url.startsWith("http://") || url.startsWith("https://") || url.startsWith("wwww.");
}

From source file:Main.java

public static boolean isValidEmail(String emailAddress) {
    return !TextUtils.isEmpty(emailAddress) && Patterns.EMAIL_ADDRESS.matcher(emailAddress).matches();
}