我正在编写音乐播放器应用程序,我已经重复使用单个片段来显示回收者视图,按标题,艺术家,专辑和流派分类音乐。
我使用这个库https://github.com/FutureMind/recycler-fast-scroll来快速滚动部分。图书馆在音乐方面做得很好我的头衔,艺术家和专辑。当我尝试切换到流派选项卡时,BUt app force关闭了excption。所有4个片段的代码完全相同。 在跟踪日志中,没有我的代码的痕迹,我无法弄清楚我应该在哪里查看我的代码来解决这个问题。在此处附加跟踪日志,我们非常感谢您的帮助。
12-10 19:09:08.204 16317-16317/com.bhandari.player.music.musicplayer E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.bhandari.player.music.musicplayer, PID: 16317
Theme: themes:{}
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnTouchListener(android.view.View$OnTouchListener)' on a null object reference
at com.futuremind.recyclerviewfastscroll.FastScroller.initHandleMovement(FastScroller.java:186)
at com.futuremind.recyclerviewfastscroll.FastScroller.onLayout(FastScroller.java:162)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1799)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1488)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1142)
at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:836)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:850)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1193)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1142)
at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:836)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:850)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1488)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1488)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2934)
at android.view.View.layout(View.java:16639)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2179)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1939)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1115)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6023)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at andro
答案 0 :(得分:-1)
不用担心,自己解决了。 它是由于我为显示文件夹而创建的其他选项卡导致的。我使用了不同的片段,忘了将卷轴初始化为。