K1-Aria
K1-Aria

Reputation: 1146

android RecyclerView setOnScrollChangeListener need api 23?

I am using volley - CardView and RecyclerView to create a project this project give information from the json url and show in my application

But the RecyclerView.setOnScrollChangeListener just need api 23 and that will not run in other versions

What should I do?

My dependencies:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile files('libs/volley.jar') }

Upvotes: 5

Views: 9594

Answers (1)

Sanjeev
Sanjeev

Reputation: 4375

You can use addOnScrollListener it works perfectly fine

recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            super.onScrollStateChanged(recyclerView, newState);

            //onScrollStateChanged will be fire every time you scroll
            //Perform your operation here

            }
        }
    });

Upvotes: 13

Related Questions