Hello, I have a RecyclerView with 10 email. and when you flip through to 10 and back, it unloads the first elements and loads it back. (the change of pages is done by the button and I do not need to update them. 10 email is not so much, the elements are taken from the List)

How do I get him to download all 10 emails? and did not update them?

    1 answer 1

    Try this:

    mRecyclerView.setDrawingCacheEnabled(true); mRecyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); mRecyclerView.setItemViewCacheSize(10); 
    • Thanks, do not know how many emails. it is necessary to leave it as it is, is there any significant load if the data is not loaded? - Arntv
    • one
      @Arntv, there are a lot of nuances. If you have a WebView with JavaScript in your cells and you WebView heavy websites with multimeter images in them, and JS loads something, then it will be hellish and almost immediately OOM catch it. If in each cell you just have a line of text, I think there will be no problems even with a few hundred cached elements. Those. in each case everything is different. The simpler the element, the more you can cache. - Yuriy SPb
    • This is a private solution, in my opinion the problem lies in the ViewHolder itself. - Morozov
    • @Morozov, well, yes) If the vehicle is not deceiving and it has very few cells and it does not update them, then you can leave. If it updates, then you can catch a lot of bugs. I myself have tried many times to use this method, but each time I refused it, because cells after such a difficult to get redrawn - YuriySPb