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

scrollToPosition method throws exception #22

Closed
iamshajeer opened this issue Oct 31, 2016 · 1 comment
Closed

scrollToPosition method throws exception #22

iamshajeer opened this issue Oct 31, 2016 · 1 comment

Comments

@iamshajeer
Copy link

Hi,
I'm getting a crash when I call scrollToPosition() method, my code

 final CarouselLayoutManager layoutManager = new CarouselLayoutManager
                (CarouselLayoutManager.HORIZONTAL, false);
        Carousel2Adapter adapter = new Carousel2Adapter();
        ArrayList<Object> objects = getObjects();
        adapter.setObjects(objects);
        recyclerView.setAdapter(adapter);
        recyclerView.setHasFixedSize(true);
        layoutManager.setPostLayoutListener(new CarouselZoomPostLayoutListener());
        layoutManager.setMaxVisibleItems(1);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.addOnScrollListener(new CenterScrollListener());
        recyclerView.scrollToPosition(2);

I have tried with default LayoutManager (LinearLayoutManager) and it worked. exception I'm getting is

ava.lang.IllegalArgumentException: position can't be great then adapter items count. position is : 2

I have around 10 items is in my recycler view

mig35 added a commit that referenced this issue Nov 1, 2016
gradle update; android version update
@mig35
Copy link
Member

mig35 commented Nov 1, 2016

@iamshajeer
Please find new compile 'com.azoft.carousellayoutmanager:carousel:1.1.7' version

@mig35 mig35 closed this as completed Nov 1, 2016
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