title: Getting the StackTrace from original uncaughtException
body: <p>I'm trying to get the AndroidRuntime Exception StackTrace same as Logcat. However, when I Override the uncaughtException of UncaughtExceptionHandler, it gives me a different StackTrace other than the LogCat one. Here is my code: </p>
  
  <pre><code>private Thread.UncaughtExceptionHandler aovUncaughtExceptionHandler = 
      new Thread.UncaughtExceptionHandler() {
          @Override
          public void uncaughtException(Thread thread, Throwable ex) {
              StackTraceElement stackTrace[] = thread.getStackTrace();
              int stackTraceLength=stackTrace.length;
              String exceptionDescription = "";
              for (int i=0; i&lt;stackTraceLength; i++) {
                  exceptionDescription = exceptionDescription + stackTrace[i];
              }
              setException(exceptionDescription,true);
              applicationExceptionHandler.uncaughtException(thread,ex);
          }
      };
  
  public AovGaTracker() {
      applicationExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
      Thread.setDefaultUncaughtExceptionHandler(aovUncaughtExceptionHandler);
  }
  </code></pre>
  
  <p>Here is the Stacktrace when using Exception as a stacktrace source: </p>
  
  <pre><code>android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
  android.app.ActivityThread.access$800(ActivityThread.java:139)
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
  android.os.Handler.dispatchMessage(Handler.java:102)
  android.os.Looper.loop(Looper.java:136)
  android.app.ActivityThread.main(ActivityThread.java:5102)
  java.lang.reflect.Method.invokeNative(Native Method)
  java.lang.reflect.Method.invoke(Method.java:515)
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Here is the stackTrace when using Thread as a stackTace source: </p>
  
  <pre><code>dalvik.system.VMStack.getThreadStackTrace(Native Method)
  java.lang.Thread.getStackTrace(Thread.java:579)
  com.example.googleanalytics.AovGaTracker$1.uncaughtException(AovGaTracker.java:28)
  java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
  java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
  dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Here is the supposed to be StackTrace from Logcat (which is what I need): </p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: com.example.myfirstapp, PID: 18207
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myfirstapp/com.example.myfirstapp.MainActivity}:
  java.lang.IllegalArgumentException
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
  at android.app.ActivityThread.access$800(ActivityThread.java:139)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:136)
  at android.app.ActivityThread.main(ActivityThread.java:5102)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.IllegalArgumentException
  at com.example.myfirstapp.MainActivity.onCreate(MainActivity.java:21)
  at android.app.Activity.performCreate(Activity.java:5248)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
  ... 11 more
  </code></pre>
  
  <p>Is there anyway that I can execute getting the <code>stacktrace</code> after <code>uncaughtException(Thread thread, Throwable ex)</code> is executed? Do I need to use asynctask? Do I need to program asynctask on the same thread? </p>