I have had this error since the day I started my application. I already asked in his day also around here I found a mini-solution but it was never solved at all ... OutOfMemory Exceptio - Android APP with ImageViews as a "Gallery" In the end I did not use glide, it did not work very well and it was really good as I was already doing, if you want code do not hesitate to ask for it, but it is very extensive and I do not think it will be very helpful.
Anyway, I think it's impossible to do what I want to do the way I want to do it (if I could increase the number of photos shown, but I would reach a point that I would still have the same error), if I'm going to raise a series of possible solutions and I would like you to tell me how viable they are, and if you know something then you advise me.
The first solution that I can think of is the use of thumbnails , but I do not know how they work, I would like some information on these, and if I could implement them in an easy way as I have already built my app ... If you assure me that I can show in the recyclerview (that has scroll) about 200/300 images , this I think it would be the best solution ... (I can currently show about 50 images ) .
The second solution would be the possibility of using some method or something so that the cache will only load the photos that are being displayed in the recyclerview , that is, in the the moment you scroll, the images that are no longer seen will be "hidden" and the new ones will be loaded ... That is, that these thumbnails of images ( with thumbnails or without them ) appear in black ( I already saw an option that put them in null bitmaps and this happened, but I did not know how to do what I'm proposing) and when I came to those images with the scroll, then load them and eliminate the ones already loaded from the cache that are not shown now.
The third possible solution is to change the recyclerview, and to do a view with paging (an example for those who do not know what this is link , but as a gallery of photos, on each page x photos ), that is, the images that are being viewed are loaded by the cache, but I do not know how to update them and create new pages according to the images in my folder, because as I said, the loaded images are those in a folder ... And sometimes photos are downloaded to this folder, or deleted from it, and it has to be updated constantly.
I would like the final solution did not have to edit much code because the application is just finished to deliver (I've already shown) and could not change the structure of something too much.
Thank you very much for your time.