Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set an adapter of FirebaseRecyclerAdapter? #8

Open
joancolmenerodev opened this issue Dec 28, 2017 · 1 comment
Open

How to set an adapter of FirebaseRecyclerAdapter? #8

joancolmenerodev opened this issue Dec 28, 2017 · 1 comment

Comments

@joancolmenerodev
Copy link

I'm trying to put the adapter of a FirebaseRecyclerAdapter to the Carousel to display the items, but I'm not able to do that because it says :

setAdapter
(android.support.v4.view.PagerAdapter)
in CarouselPicker cannot be applied
to
(com.firebase.ui.database.FirebaseRecyclerAdapter)
 

I've created a question on StackOverflow, feel free to answer if you know the solution to how to do it :
https://stackoverflow.com/questions/48010917/custom-adapter-for-firebaseadapter

Thanks.

@Vatican-Cameos
Copy link
Member

Hi joan,
For now the carousel picker expects a CarouselViewAdapter. CarouselPicker is basically a ViewPager, so you would have to make sure your adapter is a CarouselViewAdapter instead.

List<CarouselPicker.PickerItem> imageItems = new ArrayList<>(); imageItems.add(new CarouselPicker.DrawableItem(R.drawable.i1)); imageItems.add(new CarouselPicker.DrawableItem(R.drawable.i2)); imageItems.add(new CarouselPicker.DrawableItem(R.drawable.i3)); //Create an adapter CarouselPicker.CarouselViewAdapter imageAdapter = new CarouselPicker.CarouselViewAdapter(this, imageItems, 0); //Set the adapter carouselPicker.setAdapter(imageAdapter);

Something like above. The pickerItems has two variations, DrawableItem and TextItem. Make sure you prepare the arraylist as shown above.
But if you have custom views I don't think it is supported yet. But since we have been planning to do it from a long time, we will work on custom views in the next 3 days and make sure it's there.
Are you working with custom views ? If you are, then we will take this as a priority to fix it up around the weekend. On the other hand if you just have text/ drawable items to show you are good to go with our existing pickerItem.

Also I will go through your stackoverflow question in detail and try to guide you in just a bit.

Best,
Pavan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants