Anatomy of RecyclerView: a Search for a ViewHolder



public static class RecycledViewPool {    private SparseArray<ArrayList<ViewHolder>> mScrap =                   new SparseArray<>();    private SparseIntArray mMaxScrap = new SparseIntArray();    public ViewHolder getRecycledView(int viewType) {        ArrayList<ViewHolder> scrapHeap = mScrap.get(viewType);

Offtopic: pre-layout, post-layout and predictive animations

RecycledViewPool, continued

View Cache

Pool and Cache in Action

recyclerView.getRecycledViewPool().setMaxRecycledViews(0, 20);adapter.notifyDataSetChanged();new Handler().post(new Runnable() {    @Override    public void run() {        recyclerView.getRecycledViewPool()
.setMaxRecycledViews(0, 1);

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store