I'm creating a singleton class that is static as it needs to be accessed from everywhere. This class needs to write to shared preferences often. To create Shared references object, I will need context.
I read that it is bad idea to store a reference to Context in a static class as the context can't garbage collected especially if it was activity.
Therefore, I created methods that wherever it needs to write to share preferences, I pass in context. This is resulting in creating shared preferences object, storing data, then deleting the object.
Is this ok? Why or why not?
Thank you