Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7844425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:52:11+00:00 2026-06-02T16:52:11+00:00

I would like to be able to determine, in case an exception occurs while

  • 0

I would like to be able to determine, in case an exception occurs while the user is using my application, where exactly the exception took place. I’d like to do something similar ti printStackTrace() method. (So this is during build mode, not debug mode )

Currently I’ve put almost all my methods from all my classes inside a try-catch statement (each method has a try-catch statement which encompasses all it’s instructions) and i can, at this point, display the “tree” or stack of methods if an exception occurs. But is there a way to determine either a line number of something to more precisely indicate where inside the method the exception occurred? Similar to what is displayed when you use printStackTrace().

I’m not really used with Exception handling, what is the best practice for doing this and can in be done?

EDIT

And one other thing. When i use printStackTrace() during build mode, where does it display the content, because Logcat isn’t available? Can i retrieve that information and maybe do something with it?
OR
Even better, can i use getStackTrace() during build mode and convert the stuff there in String and maybe output it somewhere?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:52:13+00:00Added an answer on June 2, 2026 at 4:52 pm

    All the exceptions that are not handled by your code and make your app crash in release mode will appear in the android developper console, close to your app.

    For this to work, you will need to retrace obfuscated stack traces.

    About exception handling : I suggest you read this for instance. You are making a mistake about exception handling if you surround all your code by a try/catch block.

    Exception handling is more subtile than that and is often influenced by design considerations (whether to treat exceptions locally or throw them back to the caller).

    To sum up : in the core of your app : don’t treat exception but throw them or let them be thrown, using the throws clause of your methods signatures. In the upper layers, closer to the UI, treat exceptions with try/catch and if an error occurs, make sure your app is in a stable state and display some usefull messages to users.

    More details (but not that much) :

    • in the database layer : throw exception. You can still catch them to log them, but throw or rethrow them to tell caller that something went wrong.
    • in the business layer : catch them, make sure your business/domain model is in a stable state and recovers from the error, and throw them back to the caller.
    • in the UI layer : catch the exceptions and display some messages to users.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like my GWT program to be able to determine whether it's in
I would like to be able to allow a user to enter a custom
I would like to be able to determine if a parent node, whose ID
I know this sounds backwards but I would like to be able to determine
Specifically for Twisted, I would like to be able to determine whether the server
I've been thinking, I would like to able to assign different messages different priorities
Would like to be able to set colors of headings and such, different font
I would like to be able to detect a square edges on variable zoom
I would like to be able to pass some context info between NLog loggers
I would like to be able to add the difference and percent change to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.