List of usage examples for android.util Log e
public static int e(String tag, String msg, Throwable tr)
From source file:Main.java
public static void log(Throwable tr) { Log.e(TAG, "Exception: " + tr, tr); }
From source file:Main.java
public static void displayErrorDialog(Activity activity, Exception e) { String message = e.getLocalizedMessage(); if (message == null || message == "") { message = e.getClass().getName(); } else {//from w ww .j a va 2s. c om message = e.getClass().getName() + ": " + message; } Log.e(activity.getClass().toString(), "Exception: " + message, e); final String title = "Error"; displayInfoBox(activity, title, message); }
From source file:Main.java
public static int getAppVersionCode(Context context) { int versioncode = -1; try {/*from w ww . j av a2 s. c o m*/ // ---get the package info--- PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); versioncode = pi.versionCode; } catch (Exception e) { Log.e("VersionInfo", "Exception", e); } return versioncode; }
From source file:Main.java
/** * error log//w ww . ja va2 s. c o m * @param msg log msg * @param e exception */ public static void e(String msg, Exception e) { if (LOG_ENABLE) { Log.e(TAG, buildMsg(msg), e); } }
From source file:Main.java
public static String getString(Context context, String category, String key) { String defaultValue = ""; try {/*w w w .j a va2 s . c o m*/ SharedPreferences setMyPref = context.getSharedPreferences(category, Activity.MODE_WORLD_READABLE); return setMyPref.getString(key, defaultValue); } catch (Exception e) { Log.e(TAG, "Error when getString, return defaultValue " + defaultValue, e); return defaultValue; } }
From source file:Main.java
public static boolean writeOneLine(String filename, String value) { FileWriter fileWriter = null; try {// ww w. j a va2s . c o m fileWriter = new FileWriter(filename); fileWriter.write(value); } catch (IOException e) { String Error = "Error writing { " + value + " } to file: " + filename; Log.e(TAG, Error, e); return false; } finally { if (fileWriter != null) { try { fileWriter.close(); } catch (IOException ignored) { // failed to close writer } } } return true; }
From source file:Main.java
/** * Logs the data to the android Log.e . * //from ww w .j av a 2 s . co m * @param tag * @param msg * @param e */ public static void e(String tag, Throwable e, String... msg) { if (show) { Log.e(tag, toString(msg), e); } }
From source file:Main.java
public static boolean isPackageInstalled(String packageName, PackageManager pm) { try {/* w w w .j a v a2 s. c o m*/ String mVersion = pm.getPackageInfo(packageName, 0).versionName; if (mVersion == null) { return false; } } catch (NameNotFoundException notFound) { Log.e(TAG, "Package could not be found!", notFound); return false; } return true; }
From source file:Main.java
public static void e(String tag, String msg, Throwable tr) { if (DEBUG) { Log.e(tag, msg, tr); } }
From source file:Main.java
public static String getResourceString(String paramString, Activity paramActivity) { Class localClass = null;//from ww w. j a va2 s . c om if (0 == 0) ; try { localClass = Class.forName(paramActivity.getPackageName() + ".R$string"); String str = paramActivity.getResources() .getString(((Integer) localClass.getDeclaredField(paramString).get(null)).intValue()); return str; } catch (Exception localException) { Log.e(paramActivity.getPackageName(), localException.getMessage(), localException); paramActivity.finish(); } return ""; }