'when scroll end multiple request retrofit send when user two time bottom hit how to control it

I am using retrofit in my app to get data from server 15 results each request all working is fine but when I hit bottom retrofit send a request for new data it's fine but sometimes when progress is showing I scroll again retrofit send again request how to fix it

 nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
                 @Override
                 public void onScrollChange(NestedScrollView nestedScrollView, int i, int i1, int i2, int i3) {
                     if(i1==nestedScrollView.getChildAt(0).getMeasuredHeight()- nestedScrollView.getMeasuredHeight())
                     {
                         progressBar.setVisibility(View.VISIBLE);
                         allJobs();
                     }
                 }
             });

all jobs functions call two times when I hit again bottom



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source