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

public static String getUrlEncodeString(String key, String value) {
    String encodeStr = "";

    try {/*ww w.  ja va2  s.  com*/
        encodeStr = URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(value, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        Log.e("Encode Error", e.getMessage());
    }

    return encodeStr;
}

From source file:Main.java

private static String getJsonResult(String json) throws JSONException {
    JSONObject object = new JSONObject(json);
    JSONArray JSONArray_translation = object.getJSONArray("translation");
    String str_translation = JSONArray_translation.getString(0);
    Log.e("str_translation", str_translation);
    return str_translation;
}

From source file:Main.java

public static void sendBroadcast(String filter, Context context) {
    Intent startupIntent = new Intent(filter);

    try {/*from w  w  w  .  j av a  2s.com*/
        context.sendBroadcast(startupIntent);
    } catch (NullPointerException ex) {
        Log.e(TAG, "Intent broadcast failed. Error: " + ex.toString());
    }
}

From source file:Main.java

/**
 * @param pContext//from w w  w .  j av a  2  s .  co m
 * @param pFileName
 * @return
 */
public static boolean deleteAppPrivateFile(Context pContext, String pFileName) {
    try {
        return pContext.deleteFile(pFileName);
    } catch (Exception e) {
        Log.e(LOG_TAG, "deleteAppPrivateFile: " + pFileName);
        return false;
    }
}

From source file:Main.java

/**
 * Checks if we've had an error inside of OpenGL ES, and if so what that error is.
 *
 * @param label Label to report in case of error.
 *//*w  ww  .ja  va  2 s  . c o m*/
public static void checkGLError(final String tag, final String label) {
    int error;
    while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
        Log.e(tag, label + ": glError " + error);
        throw new RuntimeException(label + ": glError " + error);
    }
}

From source file:Main.java

/**
 * This method provides uniform exception handling functionality
 * @param context// w ww. j ava 2s  .c  o m
 * @param e
 * @param errmsg
 */
public static void handleException(Context context, Exception e, String errmsg) {
    Toast.makeText(context, "(e) " + errmsg, Toast.LENGTH_LONG).show();
    Log.e("Yum Exception!", errmsg);
    Log.e("Yum Exception!", e.toString());
}

From source file:Main.java

public static void showException(Activity activity, String msg, Throwable e) {
    e.printStackTrace();//from   w  ww  .ja v  a2  s  .c o m

    String s = String.format("%s: %s", msg, e.getMessage());
    showToast(activity, s);
    Log.e(TAG, s);
}

From source file:Main.java

public static int getVerCode(Context context) {
    int verCode = -1;
    try {/* w  w w  . j av a2 s.  c om*/
        verCode = context.getPackageManager().getPackageInfo("com.myapp", 0).versionCode;
    } catch (NameNotFoundException e) {
        Log.e("AppUtil", e.getMessage());
    }
    return verCode;
}

From source file:Main.java

public static String getApplicationVersion(Context context) {
    try {/*w ww . ja  v  a2  s  .c  o m*/
        return context.getApplicationContext().getPackageManager().getPackageInfo(context.getPackageName(),
                0).versionName;
    } catch (NameNotFoundException e) {
        Log.e("NameNotFoundException", e.getMessage());
    }
    return "";
}

From source file:Main.java

public static int getVerCode(Context context) {
    int verCode = -1;
    try {//from w w w.  j  ava 2s. c om

        verCode = context.getPackageManager().getPackageInfo("com.wangln", 0).versionCode;
    } catch (NameNotFoundException e) {
        Log.e("msg", e.getMessage());
    }
    return verCode;
}