Example usage for android.util Log w

List of usage examples for android.util Log w

Introduction

In this page you can find the example usage for android.util Log w.

Prototype

public static int w(String tag, Throwable tr) 

Source Link

Usage

From source file:Main.java

public static void w(String cusPreLogStr, String logStr) {
    Log.w(TAG, cusPreLogStr + logStr);
}

From source file:Main.java

public static Float stringToFloat(String str) {
    if (str == null) {
        return null;
    } else {//from   w w  w  . jav a  2  s.c  om
        try {
            return Float.parseFloat(str);
        } catch (NumberFormatException e) {
            Log.w(TAG,
                    "Unable to interpret value " + str + " in field being "
                            + "converted to float, caught NumberFormatException <" + e.getMessage()
                            + "> field discarded");
            return null;
        }
    }
}

From source file:Main.java

public static final void toastMessage(final Activity activity, final String message, String logLevel) {
    if ("w".equals(logLevel)) {
        Log.w("sdkDemo", message);
    } else if ("e".equals(logLevel)) {
        Log.e("sdkDemo", message);
    } else {//from  www  . j  a va 2  s.  c o m
        Log.d("sdkDemo", message);
    }
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            // TODO Auto-generated method stub
            if (mToast != null) {
                mToast.cancel();
                mToast = null;
            }
            mToast = Toast.makeText(activity, message, Toast.LENGTH_SHORT);
            mToast.show();
        }
    });
}

From source file:Main.java

public static void w(String msg) {
    if (isShow) {
        Log.w(TAG, msg);
    }
}

From source file:Main.java

public static String md5(String senha) {
    String sen = "";
    MessageDigest md = null;//from  w w  w.  j  a  v  a 2s  .co  m
    try {
        md = MessageDigest.getInstance("MD5");
    } catch (NoSuchAlgorithmException e) {
        Log.w("Problemas ao gerar MD5", e);
    }
    BigInteger hash = new BigInteger(1, md.digest(senha.getBytes()));
    sen = hash.toString(16);
    return sen;
}

From source file:Main.java

@Deprecated
public static int getApkVersion(Context context) {
    int i = 0;/*from  www  . ja  va2s . c  o m*/
    try {
        return context.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode;
    } catch (NameNotFoundException e) {
        Log.w("GooglePlayServicesUtil", "Google Play services is missing.");
        return i;
    }
}

From source file:Main.java

public static int getFileLines(File file) {
    if (!file.canRead() || !file.isFile()) {
        Log.w(LOG_TAG, CLASS + ": getLinesInFile: invalid file.");
        return -1;
    }//w ww. j  a  v a 2s  .  com

    int lines = 0;
    try {
        BufferedReader reader = new BufferedReader(new FileReader(file));
        while (reader.readLine() != null)
            lines++;
        reader.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

    return lines;
}

From source file:Main.java

public static void w(String tag, String msg) {
    if (isDebug) {
        if (tag == null || "".equalsIgnoreCase(tag.trim())) {
            tag = mTag;/*w w  w. j  a  va 2s .  com*/
        }
        Log.w(tag, msg);
    }
}

From source file:Main.java

public static byte[] swapColors(byte[] data, int w, int h, int pictureFormat) {
    switch (pictureFormat) {
    case ImageFormat.YV12:
        return swapYUV420Planar(data);
    case ImageFormat.NV21:
        return swapYUV420SemiPlanar(data, w, h);
    default://w ww.j  a  va2 s  .  c  o m
        Log.w("Util", "No color format to swap");
    }
    return data;
}

From source file:Main.java

public static void w(String tag, String msg) {
    if (DEBUG) {
        Log.w(tag, msg);
    }
}