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

Trigger an event whenever the image changes #121

Open
Eleuis opened this issue Jul 7, 2020 · 1 comment
Open

Trigger an event whenever the image changes #121

Eleuis opened this issue Jul 7, 2020 · 1 comment

Comments

@Eleuis
Copy link

Eleuis commented Jul 7, 2020

Is there any way to trigger an event whenever the image changes? I need to update a textview to display information related to what is currently being shown

@guilhermegchagas
Copy link

guilhermegchagas commented Jul 7, 2020

You need to add a page change listener to the carousel view.

carouselView.addOnPageChangeListener(new OnPageChangeListener() {
    public void onPageScrollStateChanged(int state) {}
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {}
    public void onPageSelected(int position) {
        // Check if this is the page you want.
    }

});

I found this solution in the link below, but i'm using C# in my project, so i don't know if that specific implementation works, but it worked in my project with some adaptations to C#.
https://stackoverflow.com/questions/11293300/determine-when-a-viewpager-changes-pages

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