Tried adding this to a viewpager that has an adapter with no items in it, and it crashes:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setImageDrawable(android.graphics.drawable.Drawable)' on a null object reference
at com.cepheuen.progresspageindicator.ProgressPageIndicator.fillDots(ProgressPageIndicator.java:222)
at com.cepheuen.progresspageindicator.ProgressPageIndicator.initialize(ProgressPageIndicator.java:185)
at com.cepheuen.progresspageindicator.ProgressPageIndicator.setViewPager(ProgressPageIndicator.java:132)
at com.seguetech.zippy.fragments.MedicineFragment.onCreateView(MyFragment.java:78)
In my fragment:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_medicine, container, false);
viewPager = (ViewPager)v.findViewById(R.id.viewpager);
imageAdapter = new ImageAdapter();
viewPager.setAdapter(imageAdapter);
// crashes on this line.
((ProgressPageIndicator)v.findViewById(R.id.pageIndicator)).setViewPager(viewPager);
}
The image adapter correctly returns a size of 0, and has no problems waiting for an event to push items into the adapter, where notifyDataSetChanged() is changed, and then the views are populated.
Tried adding this to a viewpager that has an adapter with no items in it, and it crashes:
In my fragment:
The image adapter correctly returns a size of 0, and has no problems waiting for an event to push items into the adapter, where notifyDataSetChanged() is changed, and then the views are populated.