I'm creating a breaking news app and i want to infinite scroll recyclerview but its end after its list size is done so how it is possible to auto scroll recyclerview.
By this method the autoscroll is done but it not scroll infinite
public void autoScrollAnother() {
scrollCount = 0;
final int speedScroll = 1200;
final Handler handler = new Handler();
final Runnable runnable = new Runnable() {
@Override
public void run() {
if(scrollCount == breakingNewAdapter.getItemCount()){
breakingNewAdapter.notifyDataSetChanged();
}
brakingNews.smoothScrollToPosition((scrollCount++));
handler.postDelayed(this, speedScroll);
}
};
handler.postDelayed(runnable, speedScroll);
}
And set in recyclerview like this
layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
brakingNews.setLayoutManager(layoutManager);
brakingNews.setHasFixedSize(true);
brakingNews.setItemViewCacheSize(10);
brakingNews.setDrawingCacheEnabled(true);
brakingNews.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
brakingNews.setAdapter(breakingNewAdapter);
Any help it will more help full