Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 242
Registered: ‎02-19-2013
My Device: 9500
My Carrier: _

Convert the e.printstacktrace to string

I want to get the error trace in string variable. How can i do it in blackberry.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Convert the e.printstacktrace to string

AFAIK you can't sorry.  The only place it can be put is in the log. 

 

And in order to get a strack trace, you have to chatch Throwable.  Catching an Exception throws away the stack trace.

 

Here is sample code to get a stack trace.

 

      try {
      } catch (Throwable t) {
       t.printStackTrace();
       System.out.println("Throwbable: " + t.toString());
      }

Developer
Posts: 242
Registered: ‎02-19-2013
My Device: 9500
My Carrier: _

Re: Convert the e.printstacktrace to string

It give me name of exception rather than complete exception.

 

Could you help to get the complete exceptin like line no , in which class exception occur and exception and name.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Convert the e.printstacktrace to string

Sorry, the stack trace is the only way to get that, and as noted, it is only captured when you catch Throwable, and you can't get the stack trace in a String in your application, just in the log.