sayyam / carouselview

A simple library to add carousel view in android app.
Apache License 2.0
1.15k stars 261 forks source link

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

Open Nutomic opened 8 years ago

Nutomic commented 8 years ago

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

jose920405 commented 8 years ago

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

ravirajjak commented 7 years ago

I am getting the same Error

rajscet commented 7 years ago

me too

letuszou commented 7 years ago

me too

zayedelfasa commented 7 years ago

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.

Spieleckecker commented 6 years ago

I've got the same problem

1SStorm commented 6 years ago

how can reslove?

1SStorm commented 6 years ago

call setImageListener before setPageCount will reslove!

shubhamkhuva commented 6 years ago

Thank you @1SStorm

felix-mutuku commented 6 years ago

you're a life saver @1SStorm

tolusoft commented 6 years ago

Thanks! Saved my day.

fadiramzi commented 6 years ago

call setImageListener before setPageCount will reslove!

Oooh , thanks bro, you saved me :)

cjamcu commented 6 years ago

@1SStorm Muchas gracias :+1:

avifi commented 5 years ago

thanks, you have resolved my problem

ingmarsell commented 5 years ago

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

call setImageListener before setPageCount will reslove!

README.md example calls setPageCount before.

gsancho commented 5 years ago

Thanks a lot @1SStorm Saved my day!!

Rithprohos commented 4 years ago

call setImageListener before setPageCount will reslove!

Thanks

jamesnyakush commented 4 years ago

you're a life saver @1SStorm

sumit-kmr commented 4 years ago

@1SStorm thanks buddy you saved my day

yewrajesh commented 4 years ago

Even i interchange the position it not working for me

pawank0411 commented 4 years ago

thank you @1SStorm

gmccarrasco commented 3 years ago

Thank you mate @1SStorm !!

Capitaoneo3 commented 3 years ago

Obrigado @1SStorm

V1c70rr commented 2 years ago

Thank you @1SStorm, u save me!