-
Notifications
You must be signed in to change notification settings - Fork 4k
NPE when touching ViewPagerIndicator when rotating device #108
Description
Found this when testing my application, and was able to reproduce on the ViewPager Indicator sample app. Logcat output from the sample app is below. To reproduce, simply touch and hold on the ViewPagerIndicator bar then rotate the device.
07-10 07:45:39.837 4119 4119 E AndroidRuntime: FATAL EXCEPTION: main
07-10 07:45:39.837 4119 4119 E AndroidRuntime: java.lang.NullPointerException
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.support.v4.app.Fragment.setUserVisibleHint(Fragment.java:746)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.support.v4.app.FragmentPagerAdapter.setPrimaryItem(FragmentPagerAdapter.java:128)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.support.v4.view.ViewPager.populate(ViewPager.java:802)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:433)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:405)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:386)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at com.viewpagerindicator.TitlePageIndicator.onTouchEvent(TitlePageIndicator.java:531)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.View.dispatchTouchEvent(View.java:3885)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1154)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1749)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.ViewRoot.doDie(ViewRoot.java:2760)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.ViewRoot.die(ViewRoot.java:2730)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:218)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.view.Window$LocalWindowManager.removeViewImmediate(Window.java:436)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:2824)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2929)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.app.ActivityThread.access$1600(ActivityThread.java:124)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:972)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.os.Looper.loop(Looper.java:130)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:3806)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:507)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-10 07:45:39.837 4119 4119 E AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
07-10 07:45:39.877 2015 2015 D AutoScanCheckReceiver: Entering onReceive.
07-10 07:45:39.877 2015 2015 D AutoScanCheckReceiver: Action type:android.intent.action.CONFIGURATION_CHANGED
07-10 07:45:39.877 2015 2015 D AutoScanCheckReceiver: Received CONFIGURATION_CHANGED but not a flip, no scan initiated.
07-10 07:45:39.877 1685 2099 W ActivityManager: Force finishing activity com.viewpagerindicator.sample/.SampleTitlesStyledTheme