我怎么能知道一个空指针异常起源? [英] How can I know where a Null Pointer Exception originated?

查看:121
本文介绍了我怎么能知道一个空指针异常起源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不作出黑莓应用程序有问题。我发现有些家伙谁做了一个教程,做了什么,我试图用我的。我复制本教程的应用程序的code,试图重建它,只是看到它在行动。结果:空指针异常

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?

推荐答案

可以,如果你赶上赶上异常或异常的任何子类的Throwable而不是查看堆栈跟踪。例如。

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.  
}

这篇关于我怎么能知道一个空指针异常起源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆