Imagine a class which wraps an external API or read large files or parses huge XML files, fetches data from the Internet or something else. There are thousands of situations like that.
In many cases, you can want to not parse/download/load some resources every time, right?. A good option is to use a cache but, to be honest, it’s difficult. In this article I’ll show you a simple and flexible solution.
I’ve started learning Java and Android. I will tell more about the project in the future. After a while, I tried to pass an object to Android activity to give a possibility to edit some data in a form. Because you do not create activities directly, you cannot just pass them to a constructor or add a setter to it. It’s more complicated.
I started looking for an answer and I found a post on StackOverflow with few possible solutions.