在ViewGroup.dispatchDraw()上获取多个NPE

时间:2014-07-21 05:34:22

标签: android android-layout

java.lang.NullPointerException
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3069)
       at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchDraw(PhoneWindow.java:2387)
       at android.view.View.getDisplayList(View.java:13580)
       at android.view.View.getDisplayList(View.java:13635)
       at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1627)
       at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1506)
       at android.view.ViewRootImpl.draw(ViewRootImpl.java:2728)
       at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2593)

在搜索时,我发现只有当我们在onAnimationEnd()中更改布局/视图时才会发生这种情况。这是我的onAnimationEnd()......

   public void onAnimationEnd(Animation animation) {
                        if(productList != null)
                            productList.bringToFront();
                        if(toggleView != null)
                            toggleView.bringToFront();
                        if(footerView != null)
                            footerView.bringToFront();
                        if(headerView != null) {
                            headerView.setVisibility(View.INVISIBLE);
                            headerView.clearAnimation();
                        }
                    }

我没有改变任何视图或布局,但仍然会遇到很多这些错误

0 个答案:

没有答案