There are e.printStackTrace() method to print exceptional error, so I would like to take entire exception in String and show it by Toast.makeText()
How can i do this?
If there are more alternate idea, then please share with me or suggest me.
There are e.printStackTrace() method to print exceptional error, so I would like to take
Share
Use the following piece of code:
There used to be a way to extract an exception stacktrace into the String in one line with
Log.getStackTraceStringcall. But starting from Android 4.0 (API 14) that method is not reliable anymore, as it returns an empty string forUnknownHostException(see Android issue #21436 for the details, in short: “to reduce the amount of log spew that apps do in the non-error condition of the network being unavailable” Android engineers made IMHO a dubious decision to modifyLog.getStackTraceStringmethod).Thus it is better to use the code I provided at the beginning of this post.