使用 ViewGroup 抛出 NullPointerException

发布于 2024-10-03 08:39:14 字数 1604 浏览 4 评论 0原文

有谁知道这可能是什么原因造成的?

11-16 16:23:26.745: ERROR/AndroidRuntime(9549): Uncaught handler: thread main exiting due to uncaught exception
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): java.lang.NullPointerException
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.view.ViewRoot.performTraversals(ViewRoot.java:722)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.os.Looper.loop(Looper.java:123)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.app.ActivityThread.main(ActivityThread.java:4363)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at java.lang.reflect.Method.invokeNative(Native Method)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at java.lang.reflect.Method.invoke(Method.java:521)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at dalvik.system.NativeStart.main(Native Method)

Does anyone have a clue what could be causing this?

11-16 16:23:26.745: ERROR/AndroidRuntime(9549): Uncaught handler: thread main exiting due to uncaught exception
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): java.lang.NullPointerException
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.view.ViewRoot.performTraversals(ViewRoot.java:722)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.os.Looper.loop(Looper.java:123)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at android.app.ActivityThread.main(ActivityThread.java:4363)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at java.lang.reflect.Method.invokeNative(Native Method)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at java.lang.reflect.Method.invoke(Method.java:521)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549):     at dalvik.system.NativeStart.main(Native Method)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

謌踐踏愛綪 2024-10-10 08:39:14

这个错误过去经常出现在我们的崩溃报告中。追踪起来非常困难,但最后我们发现有时会触发代码,从 surfaceDestroyed()(SurfaceHolder 的回调方法)中删除视图层次结构中的视图。如果您的应用程序使用 SurfaceView,请确保您没有执行任何操作来修改 surfaceDestroyed() 中的视图层次结构。

This error used to show up in our crash reports with some regularity. It was very difficult to track down, but in the end we discovered that we sometimes triggered code that removed a view from the view hierarchy from surfaceDestroyed() (the callback method from SurfaceHolder). If your app is using a SurfaceView, make sure you don't do anything to modify the view hierarchy in surfaceDestroyed().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文