Open feng88724 opened 8 years ago
The code below throw NullPointerException: scrollToChild(position, (int) (positionOffset * tabsContainer.getChildAt(position).getWidth()));
09-19 10:08:30.744: E/AndroidRuntime(5923): at com.astuetz.PagerSlidingTabStrip$PageListener.onPageScrolled(PagerSlidingTabStrip.java:361) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.dispatchOnPageScrolled(ViewPager.java:1769) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.onPageScrolled(ViewPager.java:1748) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1670) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:576) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1637) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1992) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1813) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1112) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4472) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.Choreographer.doCallbacks(Choreographer.java:555) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.Choreographer.doFrame(Choreographer.java:525) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.os.Handler.handleCallback(Handler.java:615) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.os.Handler.dispatchMessage(Handler.java:92) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.os.Looper.loop(Looper.java:137) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.app.ActivityThread.main(ActivityThread.java:4898) 09-19 10:08:30.744: E/AndroidRuntime(5923): at java.lang.reflect.Method.invokeNative(Native Method) 09-19 10:08:30.744: E/AndroidRuntime(5923): at java.lang.reflect.Method.invoke(Method.java:511) 09-19 10:08:30.744: E/AndroidRuntime(5923): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) 09-19 10:08:30.744: E/AndroidRuntime(5923): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) 09-19 10:08:30.744: E/AndroidRuntime(5923): at dalvik.system.NativeStart.main(Native Method)
It will throw NullPointerException when the adapter has no data.
The code below throw NullPointerException: scrollToChild(position, (int) (positionOffset * tabsContainer.getChildAt(position).getWidth()));
09-19 10:08:30.744: E/AndroidRuntime(5923): at com.astuetz.PagerSlidingTabStrip$PageListener.onPageScrolled(PagerSlidingTabStrip.java:361) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.dispatchOnPageScrolled(ViewPager.java:1769) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.onPageScrolled(ViewPager.java:1748) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.pageScrolled(ViewPager.java:1670) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:576) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1637) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.View.layout(View.java:14055) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewGroup.layout(ViewGroup.java:4604) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1992) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1813) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1112) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4472) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.Choreographer.doCallbacks(Choreographer.java:555) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.Choreographer.doFrame(Choreographer.java:525) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.os.Handler.handleCallback(Handler.java:615) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.os.Handler.dispatchMessage(Handler.java:92) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.os.Looper.loop(Looper.java:137) 09-19 10:08:30.744: E/AndroidRuntime(5923): at android.app.ActivityThread.main(ActivityThread.java:4898) 09-19 10:08:30.744: E/AndroidRuntime(5923): at java.lang.reflect.Method.invokeNative(Native Method) 09-19 10:08:30.744: E/AndroidRuntime(5923): at java.lang.reflect.Method.invoke(Method.java:511) 09-19 10:08:30.744: E/AndroidRuntime(5923): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) 09-19 10:08:30.744: E/AndroidRuntime(5923): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) 09-19 10:08:30.744: E/AndroidRuntime(5923): at dalvik.system.NativeStart.main(Native Method)