title: About java Throwable
body: <p>when I develop android application,I want to make a CrashReport class and then use it send report to my server.</p>
  
  <p>I make a class called CrashHandler which implement UncaughtExceptionHandler,and make a example to cause a NullPoint error in Activity in purpose，the class works well , but a little problem... 
  in method uncaughtException：</p>
  
  <pre><code>    @Override
      public void uncaughtException(Thread thread, Throwable ex) {
          ex.printStackTrace(); //**code line 1**
  
          ....//some other codes and variables
  
          StackTraceElement[] elements = ex.getStackTrace(); 
          for (StackTraceElement element : elements) {       // **code line 2**
              errorString = errorString + "&lt;br/&gt;" + element.toString();
      }
      }
  </code></pre>
  
  <p>code line 1 print the stack trace as:</p>
  
  <pre><code>java.lang.NullPointerException
  
  my.app.ExceptionCaughtActivity$1.onClick(ExceptionCaughtActivity.java:25)
  android.view.View.performClick(View.java:2486)
  android.view.View$PerformClick.run(View.java:9130)
  android.os.Handler.handleCallback(Handler.java:587)
  android.os.Handler.dispatchMessage(Handler.java:92)
  android.os.Looper.loop(Looper.java:130)
  android.app.ActivityThread.main(ActivityThread.java:3703)
  java.lang.reflect.Method.invokeNative(Native Method)
  java.lang.reflect.Method.invoke(Method.java:507)
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
  dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>but the codeline only show:</p>
  
  <pre><code>my.app.ExceptionCaughtActivity$1.onClick(ExceptionCaughtActivity.java:25)
  android.view.View.performClick(View.java:2486)
  android.view.View$PerformClick.run(View.java:9130)
  android.os.Handler.handleCallback(Handler.java:587)
  android.os.Handler.dispatchMessage(Handler.java:92)
  android.os.Looper.loop(Looper.java:130)
  android.app.ActivityThread.main(ActivityThread.java:3703)
  java.lang.reflect.Method.invokeNative(Native Method)
  java.lang.reflect.Method.invoke(Method.java:507)
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
  dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>you notice it not showed the:</p>
  
  <pre><code>"java.lang.NullPointerException"
  </code></pre>
  
  <p>I konw I do not called the getCause()
  but when try to use getCause(), it return a null, not a throwable;</p>
  
  <p>I tried to view the source code of throwable class...but got noting </p>
  
  <p>can you tell me why the getCause is null but printStackTrace have a error cause to print out ??</p>