3

我的应用程序中有一个弹出窗口,一旦我NullPointerException在测试时得到以下信息。但是我的代码不在堆栈跟踪中。

/dalvikvm(15212): threadid=1: thread exiting with uncaught exception (group=0x409f71f8)
E/AndroidRuntime(15212): FATAL EXCEPTION: main
E/AndroidRuntime(15212): java.lang.NullPointerException
E/AndroidRuntime(15212):    at android.view.View.onDetachedFromWindow(View.java:9709)
E/AndroidRuntime(15212):    at android.widget.TextView.onDetachedFromWindow(TextView.java:4492)
E/AndroidRuntime(15212):    at android.view.View.dispatchDetachedFromWindow(View.java:9818)
E/AndroidRuntime(15212):    at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2266)
E/AndroidRuntime(15212):    at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2266)
E/AndroidRuntime(15212):    at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:2248)
E/AndroidRuntime(15212):    at android.view.ViewRootImpl.doDie(ViewRootImpl.java:3707)
E/AndroidRuntime(15212):    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2584)
E/AndroidRuntime(15212):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(15212):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(15212):    at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime(15212):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(15212):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(15212):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(15212):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(15212):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1195):   Force finishing activity com.android.contacts/.activities.PeopleActivity

谁能帮我找到根本原因?

4

1 回答 1

0

您可能会在弹出窗口显示之前调用finish(),即在它附加到您的窗口之前。交叉检查您为 PeopleActivity 调用 finish() 的位置。

于 2012-06-18T10:53:32.213 回答