kanytu / android-material-drawer-template

An Android template with navigation drawer for material design
Apache License 2.0
674 stars 217 forks source link

Selecting Items does not register a click or throws NPE #42

Closed angelofrancisco closed 9 years ago

angelofrancisco commented 9 years ago

I've been using your Material Drawer implementation even before it was a template. Recently I've been experiencing this bug where clicking on a row item triggers it as selected but it does not go to the specified fragment. If I keep selecting items it throws the error below. Note that this is also present in a newly created project with this template.

java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference
            at android.support.v7.widget.OrientationHelper$2.getDecoratedStart(OrientationHelper.java:316)
            at android.support.v7.widget.LinearLayoutManager.findOneVisibleChild(LinearLayoutManager.java:1633)
            at android.support.v7.widget.LinearLayoutManager.findFirstVisibleChildClosestToStart(LinearLayoutManager.java:1453)
            at android.support.v7.widget.LinearLayoutManager.computeScrollOffset(LinearLayoutManager.java:997)
            at android.support.v7.widget.LinearLayoutManager.computeVerticalScrollOffset(LinearLayoutManager.java:969)
            at android.support.v7.widget.RecyclerView.computeVerticalScrollOffset(RecyclerView.java:1175)
            at android.view.View.canScrollVertically(View.java:12758)
            at android.support.v4.view.ViewCompatICS.canScrollVertically(ViewCompatICS.java:35)
            at android.support.v4.view.ViewCompat$ICSViewCompatImpl.canScrollVertically(ViewCompat.java:940)
            at android.support.v4.view.ViewCompat.canScrollVertically(ViewCompat.java:1237)
            at android.support.v7.widget.RecyclerView$LayoutManager.onInitializeAccessibilityEvent(RecyclerView.java:6594)
            at android.support.v7.widget.RecyclerView$LayoutManager.onInitializeAccessibilityEvent(RecyclerView.java:6573)
            at android.support.v7.widget.LinearLayoutManager.onInitializeAccessibilityEvent(LinearLayoutManager.java:204)
            at android.support.v7.widget.RecyclerViewAccessibilityDelegate.onInitializeAccessibilityEvent(RecyclerViewAccessibilityDelegate.java:66)
            at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.onInitializeAccessibilityEvent(AccessibilityDelegateCompat.java:228)
            at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.onInitializeAccessibilityEvent(AccessibilityDelegateCompatJellyBean.java:56)
            at android.view.View.onInitializeAccessibilityEvent(View.java:5422)
            at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:5295)
            at android.view.View$AccessibilityDelegate.sendAccessibilityEventUnchecked(View.java:20786)
            at android.support.v4.view.AccessibilityDelegateCompatIcs.sendAccessibilityEventUnchecked(AccessibilityDelegateCompatIcs.java:117)
            at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateIcsImpl.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:210)
            at android.support.v4.view.AccessibilityDelegateCompat.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:358)
            at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:255)
            at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.sendAccessibilityEventUnchecked(AccessibilityDelegateCompatJellyBean.java:82)
            at android.view.View.sendAccessibilityEventUnchecked(View.java:5280)
            at android.view.ViewRootImpl$SendWindowContentChangedAccessibilityEvent.run(ViewRootImpl.java:6951)
            at android.view.ViewRootImpl$SendWindowContentChangedAccessibilityEvent.runOrPost(ViewRootImpl.java:6977)
            at android.view.ViewRootImpl.postSendWindowContentChangedCallback(ViewRootImpl.java:6138)
            at android.view.ViewRootImpl.notifySubtreeAccessibilityStateChanged(ViewRootImpl.java:6251)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.View.notifySubtreeAccessibilityStateChangedIfNeeded
kanytu commented 9 years ago

What changes did you make to get this exception? I can't reproduce this error so it's going to be hard to develop a fix for it

Jonathan727 commented 9 years ago

@angelofrancisco which android version does this happen on?

angelofrancisco commented 9 years ago

@Jonathan727 It happened on 5.0, using the Material template app. @kanytu I did not make any changes, I get it even on a newly created template.

kanytu commented 9 years ago

@angelofrancisco this was fixed on https://github.com/kanytu/android-material-drawer-template/issues/43