List of usage examples for java.lang Throwable printStackTrace
public void printStackTrace()
From source file:Main.java
public static String getStackTrace(Throwable aThrowable) { aThrowable.printStackTrace(); final Writer result = new StringWriter(); final PrintWriter printWriter = new PrintWriter(result); aThrowable.printStackTrace(printWriter); return result.toString(); }
From source file:Main.java
public static void showInputMethodWindow(Activity activity, View view) { try {/* w ww . j ava2s . c o m*/ ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } catch (Throwable th) { th.printStackTrace(); } }
From source file:Main.java
public static int getVersionCode(Context context) { try {// w w w.jav a 2s .c o m PackageManager packageManager = context.getPackageManager(); return packageManager.getPackageInfo(context.getPackageName(), 0).versionCode; } catch (Throwable error) { error.printStackTrace(); return 0; } }
From source file:Main.java
public static String getVersionName(Context context) { try {//from w w w. j a v a 2s. c o m PackageManager packageManager = context.getPackageManager(); return packageManager.getPackageInfo(context.getPackageName(), 0).versionName; } catch (Throwable error) { error.printStackTrace(); return ""; } }
From source file:Main.java
public static LinkedList<byte[]> eatUpJavaHeap(LinkedList<byte[]> list, int eatUpSize, int atomSize) { try {/* w w w .j av a 2 s .com*/ while (list.size() * atomSize < eatUpSize) { list.add(new byte[atomSize]); } } catch (Throwable t) { t.printStackTrace(); } finally { } return list; }
From source file:Main.java
/** * vonvert Object to json string./* w ww . j a v a2s .c o m*/ * @param object Object * @return json string. */ public static String toJsonString(Object object) { try { return sGson.toJson(object); } catch (Throwable var2) { var2.printStackTrace(); return ""; } }
From source file:Main.java
static public int getLargeMemoryClass(ActivityManager am) { if (methodGetLargeMemoryClass != null) { try {/*ww w. j a va2s . c o m*/ Object result = methodGetLargeMemoryClass.invoke(am); return (Integer) result; } catch (Throwable t) { t.printStackTrace(); } } return am.getMemoryClass(); }
From source file:Main.java
private static String getApkPath(Context context) { String apkPath = null;/*from www. j a va 2s . c om*/ try { ApplicationInfo applicationInfo = context.getApplicationInfo(); if (applicationInfo == null) { return null; } else { apkPath = applicationInfo.sourceDir; } } catch (Throwable e) { e.printStackTrace(); } return apkPath; }
From source file:Main.java
public static void dumpHprof(String path) { try {/*from w w w .ja v a 2 s . c o m*/ String name = getDate() + OOM_SUFFIX; path = path + File.separator + name; File file = path != null ? new File(path) : null; if (!file.getParentFile().exists()) file.getParentFile().mkdirs(); Debug.dumpHprofData(path); } catch (Throwable t) { t.printStackTrace(); } }
From source file:Main.java
public static void foreDelay(final Runnable r, final long millSeconds) { main.postDelayed(new Runnable() { @Override// w w w. j a va2 s . c o m public void run() { try { r.run(); } catch (Throwable e) { e.printStackTrace(); } } }, millSeconds); }