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 String removeStringSuffix(String s, String suffix) { String retval = s;//from ww w . j ava2 s .c o m if ((null != s) && (null != suffix)) { int sLen = s.length(); int suffixLen = suffix.length(); if (suffixLen <= sLen) { try { String t = s.substring(sLen - suffixLen, sLen); if (suffixLen == sLen) { retval = ""; } else if (suffix.equals(t)) { retval = s.substring(0, sLen - suffixLen - 1); } } catch (Exception e) { //^^FE1=removeSuffix() Log.e(TAG, "^^FE1", e); } } } Log.d(TAG, "AqUtils.removeStringSuffix(). s,suffix,retval: " + s + "," + suffix + "," + retval); return retval; }
From source file:Main.java
public static boolean isNewVersion(final Context context) { final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context); final String v0 = p.getString(PREFS_LAST_RUN, ""); String v1 = null;/*from w ww . j a va 2s. com*/ try { v1 = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { Log.e(TAG, "package not found: " + context.getPackageName(), e); } if (v0.equals(v1)) { return false; } return true; }
From source file:Main.java
public static int findProcessId(String command) { int procId = -1; try {//from w w w . j a va 2s. co m procId = findProcessIdWithPidOf(command); if (procId == -1) procId = findProcessIdWithPS(command); } catch (Exception e) { try { procId = findProcessIdWithPS(command); } catch (Exception e2) { Log.e(TAG, "Unable to get proc id for command: " + URLEncoder.encode(command), e2); } } return procId; }
From source file:Main.java
public static void LOGE(final String tag, String message, Throwable cause) { Log.e(tag, message, cause); }
From source file:Main.java
public static void logError(Exception e) { if (DEBUG) { Log.e(TAG, e.getMessage(), e); } }
From source file:Main.java
public static String get(Context context, String key) { String temp = null;/* w ww . j a va2 s .c o m*/ Cursor cur = null; try { cur = context.getContentResolver().query(CONTENT_URI, null, "key='" + key + "'", null, null); if (null != cur && cur.moveToFirst()) temp = cur.getString(1); } catch (Exception e) { Log.e("AspShareUtil", "Error while get", e); } finally { if (cur != null) cur.close(); } return temp; }
From source file:Main.java
public static byte[] downloadImage(final URL url) { InputStream in = null;/*from w ww.j a va 2 s . c o m*/ int responseCode = -1; try { final HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoInput(true); con.connect(); responseCode = con.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { in = con.getInputStream(); return getByteFromInputStream(in); } } catch (final IOException e) { Log.e(LOG_TAG, "Failed to download image from: " + url.toString(), e); } return null; }
From source file:Main.java
public static boolean isDebug(Context context) { boolean ret = false; if (context == null) return false; PackageManager manager = context.getPackageManager(); try {/*from w w w.jav a2s.co m*/ PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0); int flag = info.applicationInfo.flags; if ((flag & ApplicationInfo.FLAG_DEBUGGABLE) == ApplicationInfo.FLAG_DEBUGGABLE) { ret = true; } } catch (NameNotFoundException e) { // TODO Auto-generated catch block Log.e("WxException", e.getMessage(), e); } catch (Throwable e) { // TODO: handle exception return false; } return ret; }
From source file:Main.java
private static int findProcessIdCmd(String command) { int procId = -1; try {//from w w w . j a v a2s. c om procId = findProcessIdWithPidOf(command); if (procId == -1) procId = findProcessIdWithPS(command); } catch (Exception e) { try { procId = findProcessIdWithPS(command); } catch (Exception e2) { Log.e(TAG, "Unable to get proc id for command: " + URLEncoder.encode(command), e2); } } return procId; }
From source file:Main.java
public static void copyAssets(Context pContext, String pAssetFilePath, String pDestDirPath) { AssetManager assetManager = pContext.getAssets(); InputStream in = null;//w w w . j a v a 2 s . c o m OutputStream out = null; try { in = assetManager.open(pAssetFilePath); File outFile = new File(pDestDirPath, pAssetFilePath); out = new FileOutputStream(outFile); copyFile(in, out); in.close(); in = null; out.flush(); out.close(); out = null; } catch (IOException e) { Log.e("tag", "Failed to copy asset file: " + pAssetFilePath, e); } }