I'm in the process of porting an iOS project to Android. The iOS project makes use of several key singletons to provide global resources for the application, such as a database and an set of web services. Many of these singletons use resources such as files, network, or shared preferences.
I'm running into a lot of problems trying to port this to Android, because I often require a "Context" object when I am writing singleton code that is not part of an Activity. I can usually pass in a Context when I first construct the singleton, but I have heard that I should not store this as a member variable because it could cause memory leaks.
What is the best way to deal with this issue?