How can I make program print a stack trace automatically when an Exception occurs in Android

Daniel

Is there a way I can automatically print a stack trace when Exception occurs? I understand I can do so by manually surrounding a block with a try-catch statement, but there's no prior-knowledge where an exception would happen in a program, and doing it in suspicious region block by block would be super inefficient, since there're potentially many. So is there any configuration option or any programmatic way to do so in Android?(like surrounding a try-catch block in the highest level of method?, but what's the highest level of method)

Nachi

Define a global exception handler in your Application class and add any code you need to it.

Thread.setDefaultUncaughtExceptionHandler(
                new DefaultExceptionHandler(this));

It is recommended that you still re-throw caught exceptions so that the app stops running, because it will be in an unstable state and not doing so can cause the app to freeze up.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How can I get a JavaScript stack trace when I throw an exception?

From Java

How to print the stack trace of an exception object in Python?

From Dev

How to print the stack trace of an exception object in Python?

From Dev

How can I make apigility display exception trace in ApiProblem responses?

From Dev

How can I make apigility display exception trace in ApiProblem responses?

From Dev

How can an Exception be created/thrown with no stack trace?

From Dev

How can I make an autorun to make a program open a file automatically

From Dev

How to print the selenium exception stack trace in Extent reports

From Dev

Python exception: how to print the last ten lines of stack trace?

From Dev

How to print the selenium exception stack trace in Extent reports

From Dev

How do I see the full stack trace when I catch an exception

From Java

How can I convert a stack trace to a string?

From Dev

How can I make program automatically startup on login?

From Dev

Storm: How to resubmit topology automatically when it occurs exception?

From Dev

How to print stack trace (with symbolic function names) on Android?

From Dev

How to print stack trace (with symbolic function names) on Android?

From Dev

How can I ask a JMS server to resend the message when an exception occurs in a JMS listener defined with the @JmsListener annotation?

From Dev

How would I make a recursive trace print out like this?

From Dev

Exception that emails stack trace when raised

From Dev

Suppressing stack trace when catching exception

From Dev

How can I make sure a program is killed when VPN is running?

From Java

How can I get the current stack trace in Java?

From Dev

How can I extract local variables from a stack trace?

From Dev

java - How can I get a future's stack trace on TimeoutException

From Dev

pythonanywhere + flask: website just says 'unhandled exception'. How to get debugger to print stack trace?

From Dev

How can i print number of times each alphabet occurs in the string?

From Dev

how to print stack trace to stdout in java for debug?

From Dev

How can I make py.test print stack traces for test failures / errors as they happen?

From Dev

How can I make py.test print stack traces for test failures / errors as they happen?

Related Related

  1. 1

    How can I get a JavaScript stack trace when I throw an exception?

  2. 2

    How to print the stack trace of an exception object in Python?

  3. 3

    How to print the stack trace of an exception object in Python?

  4. 4

    How can I make apigility display exception trace in ApiProblem responses?

  5. 5

    How can I make apigility display exception trace in ApiProblem responses?

  6. 6

    How can an Exception be created/thrown with no stack trace?

  7. 7

    How can I make an autorun to make a program open a file automatically

  8. 8

    How to print the selenium exception stack trace in Extent reports

  9. 9

    Python exception: how to print the last ten lines of stack trace?

  10. 10

    How to print the selenium exception stack trace in Extent reports

  11. 11

    How do I see the full stack trace when I catch an exception

  12. 12

    How can I convert a stack trace to a string?

  13. 13

    How can I make program automatically startup on login?

  14. 14

    Storm: How to resubmit topology automatically when it occurs exception?

  15. 15

    How to print stack trace (with symbolic function names) on Android?

  16. 16

    How to print stack trace (with symbolic function names) on Android?

  17. 17

    How can I ask a JMS server to resend the message when an exception occurs in a JMS listener defined with the @JmsListener annotation?

  18. 18

    How would I make a recursive trace print out like this?

  19. 19

    Exception that emails stack trace when raised

  20. 20

    Suppressing stack trace when catching exception

  21. 21

    How can I make sure a program is killed when VPN is running?

  22. 22

    How can I get the current stack trace in Java?

  23. 23

    How can I extract local variables from a stack trace?

  24. 24

    java - How can I get a future's stack trace on TimeoutException

  25. 25

    pythonanywhere + flask: website just says 'unhandled exception'. How to get debugger to print stack trace?

  26. 26

    How can i print number of times each alphabet occurs in the string?

  27. 27

    how to print stack trace to stdout in java for debug?

  28. 28

    How can I make py.test print stack traces for test failures / errors as they happen?

  29. 29

    How can I make py.test print stack traces for test failures / errors as they happen?

HotTag

Archive