Example usage for android.util Log e

List of usage examples for android.util Log e

Introduction

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

Prototype

public static int e(String tag, String msg) 

Source Link

Document

Send an #ERROR log message.

Usage

From source file:Main.java

/**
 * This method provides uniform logging functionality for given message
 * @param context/*from   w  w  w.  j a v a2s. c o m*/
 * @param errmsg
 */
public static void handleError(Context context, String errmsg) {
    Toast.makeText(context, errmsg, Toast.LENGTH_LONG).show();
    Log.e("Yum Exception!", errmsg);
}

From source file:Main.java

public static Date fromStringToDate(String string) {
    SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy");
    Date date = null;//from  w w w . java2  s .c o  m
    try {
        date = ft.parse(string);
    } catch (ParseException e) {
        Log.e("PARSEEXC", "DATEPARSINGFAILED");
    }
    return date;
}

From source file:Main.java

static public boolean printAllInform(Class clsShow) {
    try {//from   w  ww .  ja  v  a 2  s .  c  o  m
        Method[] methods = clsShow.getMethods();
        int i = 0;
        for (; i < methods.length; i++) {
            Log.e(TAG, methods[i].getName() + ";and the i is:" + i);
        }
        Field[] allFields = clsShow.getFields();
        for (i = 0; i < allFields.length; i++) {
            Log.e(TAG, allFields[i].getName());
        }
    } catch (Exception e) {
        // TODO: handle exception
        return false;
    }
    return true;
}

From source file:Main.java

/**
 * /*w ww.j  av  a2  s  .  c om*/
 * @param lat1
 * @param lng1
 * @param lat2
 * @param lng2
 * @return distance in km
 */

public static float distFrom(double lat1, double lng1, double lat2, double lng2) {
    Log.e("lat1" + lat1 + "  long1" + lng1, "lat 2" + lat2 + "  long2" + lng2);
    /*double earthRadius = 6371;
    double dLat = Math.toRadians(lat2 - lat1);
    double dLng = Math.toRadians(lng2 - lng1);
    lat1 = Math.toRadians(lat1);
    lat2 = Math.toRadians(lat2);
    double sindLat = Math.sin(dLat / 2);
    double sindLng = Math.sin(dLng / 2);
    double a = Math.pow(sindLat, 2) + Math.pow(sindLng, 2) * Math.cos(lat1) * Math.cos(lat2);
    double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
    double dist = earthRadius * c;
    Log.e("difference in distance",""+dist);
    return distance(lat1, lng1, lat2, lng2);*/
    float[] result = new float[3];
    Location.distanceBetween(lat1, lng1, lat2, lng2, result);
    //conversion to m
    result[0] = result[0] / 1000;

    return result[0];

}

From source file:Main.java

public static JSONObject readJSON(String contentFile) {
    try {//from   ww  w . jav a  2 s .  c  om
        // Parse the JSON
        JSONObject jso = new JSONObject(contentFile);
        return jso;
    } catch (JSONException e) {
        Log.e("JSO reading", "Error parsing a JSO file : " + e.getMessage());
    }

    return null;
}

From source file:Main.java

public static String saveImageToGallery(File file, Bitmap bmp) {
    if (bmp == null) {
        Log.e(TAG, "saveImageToGallery: the bitmap is null");
        return "";
    }// www.  j av a 2 s .  c o  m
    try {
        FileOutputStream fos = new FileOutputStream(file);
        bmp.compress(Bitmap.CompressFormat.JPEG, 100, fos);
        fos.flush();
        fos.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

    Log.e(TAG, "saveImageToGallery: the path of bmp is " + file.getAbsolutePath());
    return file.getAbsolutePath();
}

From source file:Main.java

public static double getDoubleFromString(String number) {
    if (number.length() <= 0) {
        return 0;
    } else {//w ww .j  a  va  2  s  . c o  m
        try {
            double num = Double.parseDouble(number);
            return num;
        } catch (Exception ex) {
            Log.e("Helper", ex.getMessage());
            return 0;
        }

    }
}

From source file:Main.java

public static Bitmap resize(Bitmap bitmap, int width, int height) {
    Log.e("bmhelper", width + "  " + height);
    return Bitmap.createScaledBitmap(bitmap, width, height, true);
}

From source file:Main.java

public static String getVerName(Context context) {
    String verName = "";
    try {/* ww w.j  a  v  a 2  s.c  o m*/
        verName = context.getPackageManager().getPackageInfo("com.bh.yibeitong", 0).versionName;
    } catch (NameNotFoundException e) {
        Log.e("msg", e.getMessage());
    }
    return verName;
}

From source file:Main.java

private static int validateProgram(int program) {
    int[] status = new int[1];
    GLES20.glValidateProgram(program);/*from ww  w.ja  v a2  s .c om*/

    GLES20.glGetProgramiv(program, GLES20.GL_VALIDATE_STATUS, status, 0);
    if (status[0] != GLES20.GL_TRUE) {
        Log.e(TAG, "Error validating program: " + GLES20.glGetProgramInfoLog(program));
        return 0;
    }
    return 1;
}