Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

recyclerView setOnScrollChangeListener = need api 23 (current min is 15)

Tags:

android

I have this code:

recyclerView.setOnScrollChangeListener(this);

The problem is that android studio Call requires API level 23 (current min is 15)

I found similar questions but with no right answer.

how can I solve this error?

like image 224
RGS Avatar asked Oct 15 '25 13:10

RGS


1 Answers

You could try implementing an onScrollListener instead. This is dependent on what you are implementing in your scroll events but if you are simply looking for something that is backward compatible to your min of 15 this would be the choice:

    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

        }
    }
like image 130
imaadhrizni Avatar answered Oct 19 '25 14:10

imaadhrizni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!