To manage horizontal pager, I am currently using the source code from here
I have noticed when i slide from one page to another, method onViewScrollFinished() is called upto 5 times instead of one. Though i have managed this multiple calling, but i need to know is there any ticks to handle this.
Here is my source code for managing onViewScrollFinished()
public void onViewScrollFinished(int currentPage) {
count++;
if( (previousPage != currentPage)){
Toast.makeText(MainActivity.this, ""+(currentPage+count), Toast.LENGTH_SHORT).show();
}
previousPage = currentPage;
}
Where PreviousPage is set to -1;
I don't know why it is called multiple times, but what your are doing is completely fine. In such cases I often find myself doing something like this: