Reputation: 399
I am using a recyclerView on my app and need to create a Endless list with it. i used the recyclerView.addOnScrollListener
But i am getting the following error for it.
Cannot resolve method 'addOnScrollListener(anonymous android.support.v7.widget.RecyclerView.OnScrollListener)'
My code
// Setup RecyclerView News
recyclerView = (RecyclerView) findViewById(R.id.recyclerViewDesigns);
// improve performance if you know that changes in content
// do not change the size of the RecyclerView
recyclerView.setHasFixedSize(true);
// use a linear layout manager
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerViewAdapter = new CatAdapter(Categories_page.this, arrayOfLatestnews);
recyclerView.setAdapter(recyclerViewAdapter);
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
}
});
Searched and googled alot, but i cant found the solution for it. Anybody help please.
Upvotes: 0
Views: 1495
Reputation: 4661
In the latest support library (23.1.1) the OnScrollListener
should implement two methods.
onScrollStateChanged
onScrolled
So if you update to the latest and implement the methods the issue should be resolved. Tried it now and its working. Good luck
Upvotes: 0
Reputation:
I have the same problem with my endless list with RecyclerView. Try using another version of the RecyclerView library on your gradle file.
compile 'com.android.support:recyclerview-v7:22.2.0'
Upvotes: 1