diff --git a/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java b/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java index a5e6284..5f8cdc0 100644 --- a/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java +++ b/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java @@ -516,10 +516,10 @@ public void startLoop() { if (!isLooping && isAutoPlay() && mBannerPagerAdapter != null - && - mBannerPagerAdapter.getListSize() > 1 - && isAttachedToWindow() - && lifecycleRegistry.getCurrentState() == Lifecycle.State.RESUMED) { + && mBannerPagerAdapter.getListSize() > 1 + && isAttachedToWindow() && (lifecycleRegistry == null + || lifecycleRegistry.getCurrentState() == Lifecycle.State.RESUMED + || lifecycleRegistry.getCurrentState() == Lifecycle.State.CREATED)) { mHandler.postDelayed(mRunnable, getInterval()); isLooping = true; }