ViewGroup中的Android内部NPE dispatchAttachedToWindow

时间:2014-06-04 17:23:45

标签: android android-layout nullpointerexception

有谁知道如何解决以下bug

java.lang.NullPointerException
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2434)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2434)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2434)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2434)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2434)
   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1313)
   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1110)
   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4484)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
   at android.view.Choreographer.doCallbacks(Choreographer.java:555)
   at android.view.Choreographer.doFrame(Choreographer.java:525)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4856)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
   at dalvik.system.NativeStart.main(NativeStart.java)

当应用从后台回来时,我在 Android 4.1设备上获得了几次。

1 个答案:

答案 0 :(得分:0)

你只能在4.1v上得到这个吗? 似乎您的rootview或您的窗口不可用,我们需要更多的编码器/日志信息才能获得更好的结果。

如果是这样,没有错误,你需要检查你的观点不是空的,也许GC已经退出你的观点,所以你得到这个错误。

请告诉我们更多信息,何时发生,频繁?,从背景传递了多少时间?等等