Example usage for android.util Log d

List of usage examples for android.util Log d

Introduction

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

Prototype

public static int d(String tag, String msg) 

Source Link

Document

Send a #DEBUG log message.

Usage

From source file:Main.java

/**
 * This method make a crash./*from  w  ww  .j av  a  2  s .  c o m*/
 */
public static void crash() {
    String str = "";
    int n = 5 / str.length();
    Log.d(TAG, "n=" + n);
}

From source file:Main.java

public static void logColorFormat(String tag, int colorFormat) {
    switch (colorFormat) {
    case MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar:
        Log.d(tag, "COLOR_FormatYUV420Planar");
        break;//w ww.  j a  va  2  s  .c  om
    case MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420SemiPlanar:
        Log.d(tag, "COLOR_FormatYUV420SemiPlanar");
        break;
    case MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Flexible:
        Log.d(tag, "COLOR_FormatYUV420Flexible");
        break;
    case MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface:
        Log.d(tag, "COLOR_FormatSurface");
        break;
    }
}

From source file:Main.java

/**
 * Muestra un mensaje de log//from   w w  w.  j  av  a  2s.c o m
 * @param text
 */
public static void log(String text) {
    if (DEBUG == true) {
        Log.d(LOG_TAG, text);
    }
}

From source file:Main.java

public static Bitmap resizeImage(Bitmap image, int maxWidth, int maxHeight) {
    Log.d(TAG, "[AirImagePickerUtils] Entering resizeImage: " + String.valueOf(maxWidth) + " x "
            + String.valueOf(maxHeight));
    Bitmap result = image;//  www.  j ava 2 s  . c om
    // make sure that the image has the correct height
    if (image.getWidth() > maxWidth || image.getHeight() > maxHeight && maxWidth != -1 && maxHeight != -1) {
        float reductionFactor = Math.max(Float.valueOf(image.getWidth()) / maxWidth,
                Float.valueOf(image.getHeight()) / maxHeight);

        result = Bitmap.createScaledBitmap(image, (int) (image.getWidth() / reductionFactor),
                (int) (image.getHeight() / reductionFactor), true);
        Log.d(TAG, "[AirImagePickerUtils] resized image to: " + String.valueOf(result.getWidth()) + " x "
                + String.valueOf(result.getHeight()));
    }
    Log.d(TAG, "[AirImagePickerUtils] Exiting resizeImage");
    return result;
}

From source file:Main.java

public static String getDeviceId(Context context) {

    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    Log.d("AppUtils", "getDeviceId:" + tm.getDeviceId());

    return tm.getDeviceId();
}

From source file:Main.java

public static boolean isAdmin(String xxx) {

    if (xxx.length() < 5) {
        return false;
    }//from w w  w. j  a va 2  s .c  o  m
    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 String runCommand(String[] command, String workdirectory) {
    String result = "";
    Log.d("AppUtil.class", "#" + command);
    try {/*from   w ww. jav a  2s.c  o  m*/
        ProcessBuilder builder = new ProcessBuilder(command);
        // set working directory
        if (workdirectory != null) {
            builder.directory(new File(workdirectory));
        }
        builder.redirectErrorStream(true);
        Process process = builder.start();
        InputStream in = process.getInputStream();
        byte[] buffer = new byte[1024];
        while (in.read(buffer) != -1) {
            String str = new String(buffer);
            result = result + str;
        }
        in.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}

From source file:Main.java

public static boolean isShort(String password) {
    if (password == null || password.equals("")) {
        Log.d(TAG, "password is null");
        return false;
    }//from   ww w.  j a  va2 s. c om
    String strPattern = "^[0-9A-Za-z]{6,}$";
    Pattern p = Pattern.compile(strPattern);
    Matcher m = p.matcher(password);
    return m.matches();
}

From source file:Main.java

public static void log(String owner, String message, String flag) {
    Log.d("LOG", "<message owner=\"" + owner + (!TextUtils.isEmpty(flag) ? " flag=\"" + flag + "\"" : "") + ">"
            + message + "</message>");
}

From source file:Main.java

/**
 * Logs the data to the android Log.d . 
 * /*  www  . j  a  v a 2s . c o  m*/
 * @param tag
 * @param msg
 */
public static void d(String tag, String... msg) {
    if (show) {
        Log.d(tag, toString(msg));
    }
}