Example usage for android.text TextUtils equals

List of usage examples for android.text TextUtils equals

Introduction

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

Prototype

public static boolean equals(CharSequence a, CharSequence b) 

Source Link

Document

Returns true if a and b are equal, including if they are both null.

Usage

From source file:Main.java

public static void handlerMessageError(String paramString) {
    if (TextUtils.equals(paramString, "ER_PARAM_DEVICE_TOKEN"))
        ;/*from   w w w. java2 s.c o m*/
    while ((TextUtils.equals(paramString, "ER_PARAM_INVALID"))
            || (TextUtils.equals(paramString, "ER_PARAM_APP_PACKAGE"))
            || (TextUtils.equals(paramString, "ER_PARAM_AGOO_SDK_VERSION"))
            || (TextUtils.equals(paramString, "ER_BIZ_NO_MULTIPLEX")) || (TextUtils.equals(paramString, "FAIL"))
            || (TextUtils.equals(paramString, "FAIL_SYS_SERVLET_ASYNC_TIMEOUT"))
            || (TextUtils.equals(paramString, "FAIL_SYS_SERVLET_ASYNC_ERROR"))
            || (TextUtils.equals(paramString, "FAIL_SYS_PARAM_FORMAT_ERROR"))
            || (TextUtils.equals(paramString, "FAIL_SYS_PARAM_MISSING"))
            || (TextUtils.equals(paramString, "API_STOP_SERVICE"))
            || (TextUtils.equals(paramString, "ERRCODE_AUTH_REJECT"))
            || (TextUtils.equals(paramString, "ERRCODE_APP_ACCESS_API_FAIL"))
            || (TextUtils.equals(paramString, "ERR_SID_INVALID"))
            || (TextUtils.equals(paramString, "FAIL_SYS_HSF_ASYNC_POOL_FOOL"))
            || (TextUtils.equals(paramString, "FAIL_SYS_HSF_ASYNC_TIMEOUT"))
            || (TextUtils.equals(paramString, "FAIL_SYS_HSF_THROWN_EXCEPTION_CODE"))
            || (TextUtils.equals(paramString, "FAIL_SYS_HSF_INVOKE_ERROR"))
            || (TextUtils.equals(paramString, "FAIL_SYS_HSF_NOTFOUND"))
            || (!TextUtils.equals(paramString, "FAIL_SYS_HSF_TIMEOUT")))
        return;
}

From source file:Main.java

private static Method getHasMethod(Class clazz) {
    Method[] methods = clazz.getDeclaredMethods();
    for (Method method : methods) {
        if (TextUtils.equals(method.getName(), "has")) {
            return method;
        }//w  w  w  . j  a v  a 2 s  .  co m
    }
    return null;
}

From source file:Main.java

public static String getInclude(Map<String, String> param) {
    String include = "";
    for (Map.Entry<String, String> entry : param.entrySet()) {
        if (TextUtils.equals(entry.getKey(), "include")) {
            include = entry.getValue();/*from   w ww .  j a  va2  s  .  c om*/
            break;
        }
    }
    return include;
}

From source file:Main.java

/**
 * compare two string// www.  j a va2s.c o  m
 *
 * @param actual
 * @param expected
 * @return
 * @see
 */
public static boolean isEquals(String actual, String expected) {

    return TextUtils.equals(actual, expected);
}

From source file:Main.java

private static Method getBooleanMethod(Class clazz) {
    Method[] methods = clazz.getDeclaredMethods();
    for (Method method : methods) {
        if (TextUtils.equals(method.getName(), "getBoolean")) {
            return method;
        }//w  w  w  .  ja va 2s  .  c  om
    }
    return null;
}

From source file:Main.java

public static boolean isAdmin(String xxx) {

    if (xxx.length() < 5) {
        return false;
    }/*from   w ww .ja v  a  2 s. c om*/
    xxx = xxx.substring(2, 5);
    Log.d("AdminUtils", xxx);
    if (TextUtils.equals(xxx, "gly")) {
        return true;
    }
    return false;
}

From source file:Main.java

public static int getPortraitDegree() {
    int degree = PORTRAIT_DEGREE_90;
    if (TextUtils.equals("i700v", Build.MODEL) || TextUtils.equals("A862W", Build.MODEL)) {
        degree = PORTRAIT_DEGREE_270;/*from  w  w  w . ja  v a 2s.  com*/
    }
    return degree;
}

From source file:Main.java

static boolean checkForIntentWithAction(Activity activity, String action) {
    Intent intent = activity.getIntent();
    if (intent == null) {
        return false;
    }//  ww  w .  ja va 2s .  c o m
    return TextUtils.equals(intent.getAction(), action);
}

From source file:Main.java

public static boolean isMainProcess(Context context) {
    // TODO if mainProcess is not packageName, you should modify here
    String mainProcess = context.getPackageName();
    return TextUtils.equals(getProcessName(context, android.os.Process.myPid()), mainProcess);
}

From source file:Main.java

public static boolean isExternalStorageWriteable() {
    boolean writealbe = false;
    long start = System.currentTimeMillis();
    if (TextUtils.equals(Environment.MEDIA_MOUNTED, Environment.getExternalStorageState())) {
        File esd = Environment.getExternalStorageDirectory();
        if (esd.exists() && esd.canWrite()) {
            File file = new File(esd, ".696E5309-E4A7-27C0-A787-0B2CEBF1F1AB");
            if (file.exists()) {
                writealbe = true;//  w w w  .ja v a 2s .com
            } else {
                try {
                    writealbe = file.createNewFile();
                } catch (IOException e) {
                    Log.w(TAG, "isExternalStorageWriteable() can't create test file.");
                }
            }
        }
    }
    long end = System.currentTimeMillis();
    Log.i(TAG, "Utility.isExternalStorageWriteable(" + writealbe + ") cost " + (end - start) + "ms.");
    return writealbe;
}