Answer the question
In order to leave comments, you need to log in
Android: Is it possible to cache the contents of Layouts?
Good day.
There is a ListView, and inside it a couple more LinearLayouts are dynamically inflated.
I noticed that in some cases it takes too long to create them, and I thought about caching the content.
Actually, the question is: is it possible to start, for example, LruCache, which would store objects of the LinearLayout class, and somehow reuse them?
Answer the question
In order to leave comments, you need to log in
Well, I'll answer my own question.
If you have some kind of list, in the elements of which more layouts are dynamically inserted, the best option would be to create an LruCache that will store these layouts.
And then they are simply deleted in getView() and re-inserted from LruCache (deletion is required so that the program does not crash with "The specified child already has a parent").
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question