sayyam/carouselview

CarouselView crashes if setPageCount() is called before setImageListener()

Nutomic opened this issue · 24 comments

This means the example code in the readme doens't work. Crash log:

java.lang.RuntimeException: View must set ImageListener or ViewListener.
    at com.synnapps.carouselview.CarouselView$CarouselPagerAdapter.instantiateItem(CarouselView.java:325)
    at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1006)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1154)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1088)
    at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:542)
    at com.synnapps.carouselview.CarouselView.setData(CarouselView.java:231)
    at com.synnapps.carouselview.CarouselView.setPageCount(CarouselView.java:411)
    at global.snappy.android.fragments.FeaturedFragment.updateCollections(FeaturedFragment.java:31)
    at global.snappy.android.fragments.FeaturedFragment.access$lambda$0(FeaturedFragment.java)
    at global.snappy.android.fragments.FeaturedFragment$$Lambda$1.onSuccess(Unknown Source)
    at global.snappy.android.model.Collection.lambda$fetch$0(Collection.java:42)
    at global.snappy.android.model.Collection$$Lambda$1.onSuccess(Unknown Source)
    at global.snappy.android.network.ServerRequest.onPostExecute(ServerRequest.java:122)
    at global.snappy.android.network.ServerRequest.onPostExecute(ServerRequest.java:31)
    at android.os.AsyncTask.finish(AsyncTask.java:651)
    at android.os.AsyncTask.-wrap1(AsyncTask.java)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5461)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Library version: 0.0.9
Android version: 6.0

+1 --> View must set ImageListener or ViewListener.

I am getting the same Error

me too

me too

so am i. i use carouselView when request data with volley and then carouselView get the problem "View must set ImageListener or ViewListener." I want to share my problem with carouselView. Thanks.

I've got the same problem

how can reslove?

call setImageListener before setPageCount will reslove!

Thank you @1SStorm

you're a life saver @1SStorm

Thanks! Saved my day.

call setImageListener before setPageCount will reslove!

Oooh , thanks bro, you saved me :)

@1SStorm Muchas gracias 👍

avifi commented

thanks, you have resolved my problem

Same problem with com.synnapps:carouselview:0.1.5
Solved by:

call setImageListener before setPageCount will reslove!

README.md example calls setPageCount before.

Thanks a lot @1SStorm Saved my day!!

call setImageListener before setPageCount will reslove!

Thanks

you're a life saver @1SStorm

@1SStorm thanks buddy you saved my day

Even i interchange the position it not working for me

thank you @1SStorm

Thank you mate @1SStorm !!

Obrigado @1SStorm

Thank you @1SStorm, u save me!