Comments (4)
Which version did you use? Empty ViewPager bug was fixed at #22 (v1.1.5 )
from circleindicator.
I am using 1.1.5
Here is how to reproduce,
-
Setup ViewPager
-
Setup Adapter (Adapter is empty) (Added code sample)
-
after some delay (handler.postDelayed) , populate adapter and set notifyDataSetChanged()
public class MediaAdapter extends FragmentPagerAdapter { ArrayList<MediaFragment> fragments = new ArrayList<MediaFragment>(); public MediaAdapter(FragmentManager fm) { super(fm); } public void add(ImageRequest imageRequest,String videoUrl){ if(imageRequest==null && videoUrl==null) return; MediaFragment mediaFragment = new MediaFragment(); mediaFragment.setImageRequest(imageRequest); mediaFragment.setVideoUrl(videoUrl); fragments.add(mediaFragment); this.notifyDataSetChanged(); } @Override public Fragment getItem(int position) { return fragments.get(position); } @Override public int getCount() { return fragments.size(); } @Override public CharSequence getPageTitle(int position) { return ""; } }
from circleindicator.
Can confirm. This is the top of the stack trace:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setBackgroundResource(int)' on a null object reference
at me.relex.circleindicator.CircleIndicator.onPageSelected(CircleIndicator.java:157)
at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1794)
at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:569)
This can be fixed around in the client app by calling setViewPager after changing the adapter data.
from circleindicator.
Fix f83dfa4
from circleindicator.
Related Issues (20)
- RecyclerView + PagerSnapHelper HOT 1
- Circleinidcator2 is having unusal background colur HOT 1
- Circleindicator2 indicator is not visible when navigating to other screen and comes back HOT 3
- CircleIndicator2 with RecyclerView
- in recyclerview it is showing square not circle HOT 1
- Move away from jcenter since it'll be shutdown on May 1st 2021 HOT 8
- setViewPager error while working with viewPager2 HOT 2
- Does it have a scrool? HOT 1
- Gone selected indicator HOT 1
- cannot use with ConcatAdapter
- Active indicator is not being shown if a recycler view has 25 and more items
- There isn't any scroll if indicators count more then the screen able to fit
- Changing the color of the cirle
- In some cases it would be nice to have an access to `BaseCircleIndicator` class
- Changing color of circle in programatically HOT 2
- Gradle Implementation of CircularIndicator not working in minSdk 23
- Changing the size of the indicator icon HOT 3
- How to obtain the last indicator?
- CircleIndicator2 doesn't show after scrolling in recyclerview HOT 1
- εΊε€§ε°
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circleindicator.