Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I know where a Null Pointer Exception originated?

I had a problem making a Blackberry app. I found some guy who made a tutorial which did what I attempted with mine. I copied the code of the tutorial's app to try and recreate it, just to see it in action. The result: Null Pointer Exception.

I want to know what is triggering this. How can I?

like image 474
navand Avatar asked Oct 20 '25 16:10

navand


1 Answers

You can view the stacktrace if you catch Throwable instead of catching Exception or any subclass of Exception. e.g.

try
{
   //some code
}
catch(Throwable t)
{
    //Will automatically show a stacktrace in eclipse.  
    //I believe on a real device it will put the stacktrace in the eventlog.  
}
like image 78
Jonathan Avatar answered Oct 23 '25 05:10

Jonathan