Example usage for android.util Log ERROR

List of usage examples for android.util Log ERROR

Introduction

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

Prototype

int ERROR

To view the source code for android.util Log ERROR.

Click Source Link

Document

Priority constant for the println method; use Log.e.

Usage

From source file:Main.java

public static int e(String msg) {
    return println(Log.ERROR, DEFAULT_LOG_TAG, msg);
}

From source file:Main.java

/**
 * @param message     Message to display
 * @param type        [Log.Error, Log.Warn, ...]
 * @param shouldPrint value that comes from Preferences which allows the user to decide if debug info should be printed to logcat. Error info will ALWAYS be displayed despite this value
 *///from   ww  w .  j  a  v a 2  s .c o  m
public static void debugFunc(String message, int type, boolean shouldPrint) {
    // errors must always be displayed
    if (type == Log.ERROR) {
        Log.e(LOG_TAG, message);
    } else if (shouldPrint) {
        switch (type) {
        case Log.DEBUG:
            Log.d(LOG_TAG, message);
            break;
        case Log.INFO:
            Log.i(LOG_TAG, message);
            break;
        case Log.VERBOSE:
            Log.v(LOG_TAG, message);
            break;
        case Log.WARN:
            Log.w(LOG_TAG, message);
            break;
        default:
            Log.v(LOG_TAG, message);
            break;
        }
    }
}

From source file:Main.java

public static int e(String tag, String msg) {
    return println(Log.ERROR, tag, msg);
}

From source file:Main.java

public static File getPhotoCacheDir(Context context, File file) {
    File cacheDir = context.getCacheDir();
    if (cacheDir != null) {
        File mCacheDir = new File(cacheDir, DEFAULT_DISK_CACHE_DIR);
        if (!mCacheDir.mkdirs() && (!mCacheDir.exists() || !mCacheDir.isDirectory())) {
            return file;
        } else {/*  w ww.ja v  a 2s  . co m*/
            return new File(mCacheDir, file.getName());
        }
    }
    if (Log.isLoggable(TAG, Log.ERROR)) {
        Log.e(TAG, "default disk cache dir is null");
    }
    return file;
}

From source file:Main.java

public static void e(String tag, Object... messages) {
    log(tag, Log.ERROR, null, messages);
}

From source file:Main.java

public static int e(String tag, String msg, Throwable tr) {
    return println(Log.ERROR, tag, msg + '\n' + getStackTraceString(tr));
}

From source file:Main.java

public static void e(String tag, Throwable t, Object... messages) {
    log(tag, Log.ERROR, t, messages);
}

From source file:Main.java

/**
 * This is an expensive operation that copies the image in place with the pixels rotated.
 * If possible rather use getOrientationMatrix, and set that as the imageMatrix on an ImageView.
 *
 * @param imageToOrient Image Bitmap to orient.
 * @param degreesToRotate number of degrees to rotate the image by. If zero the original image is returned unmodified.
 * @return The oriented bitmap. May be the imageToOrient without modification, or a new Bitmap.
 *//* w w w. ja v a  2  s  .co m*/
public static Bitmap rotateImage(Bitmap imageToOrient, int degreesToRotate) {
    try {
        if (degreesToRotate != 0) {
            Matrix matrix = new Matrix();
            matrix.setRotate(degreesToRotate);
            imageToOrient = Bitmap.createBitmap(imageToOrient, 0, 0, imageToOrient.getWidth(),
                    imageToOrient.getHeight(), matrix, true);
        }
    } catch (Exception e) {
        if (Log.isLoggable(TAG, Log.ERROR)) {
            Log.e(TAG, "Exception when trying to orient image", e);
        }
        e.printStackTrace();
    }
    return imageToOrient;
}

From source file:Main.java

private static void log(String tag, int level, String msg, Throwable tr) {
    if (isLog) {//w ww .  j  a v a2 s  .c  om
        switch (level) {
        case Log.VERBOSE:
            if (tr == null) {
                Log.v(tag, msg);
            } else {
                Log.v(tag, msg, tr);
            }
            break;
        case Log.INFO:
            if (tr == null) {
                Log.i(tag, msg);
            } else {
                Log.i(tag, msg, tr);
            }
            break;
        case Log.DEBUG:
            if (tr == null) {
                Log.d(tag, msg);
            } else {
                Log.d(tag, msg, tr);
            }
            break;
        case Log.WARN:
            if (tr == null) {
                Log.w(tag, msg);
            } else {
                Log.w(tag, msg, tr);
            }
            break;
        case Log.ERROR:
            if (tr == null) {
                Log.e(tag, msg, tr);
            } else {
                Log.e(tag, msg, tr);
            }
            break;
        }
    }
}

From source file:Main.java

/**
 * Returns a matrix with rotation set based on Exif orientation tag.
 * If the orientation is undefined or 0 null is returned.
 *
 * @param pathToOriginal Path to original image file that may have exif data.
 * @return  A rotation in degrees based on exif orientation
 *///w  w w .j  a  v  a2  s  .  c  o  m
public static int getOrientation(String pathToOriginal) {
    int degreesToRotate = 0;
    try {
        ExifInterface exif = new ExifInterface(pathToOriginal);
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_UNDEFINED);
        if (orientation == ExifInterface.ORIENTATION_ROTATE_90) {
            degreesToRotate = 90;
        } else if (orientation == ExifInterface.ORIENTATION_ROTATE_180) {
            degreesToRotate = 180;
        } else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) {
            degreesToRotate = 270;
        }
    } catch (Exception e) {
        if (Log.isLoggable(TAG, Log.ERROR)) {
            Log.e(TAG, "Unable to get orientation for image with path=" + pathToOriginal, e);
        }
    }
    return degreesToRotate;
}