How to properly manage contexts for an android application(non-activity classes)
<p><strong>Similar posts that do not have the answer i'm looking for.</strong> </p>

<p><a href="http://stackoverflow.com/questions/987072/using-application-context-everywhere">Using Application context everywhere?</a></p>

<p><a href="http://developer.android.com/reference/android/app/Application.html" rel="nofollow">http://developer.android.com/reference/android/app/Application.html</a></p>

<p><a href="http://stackoverflow.com/questions/2002288/static-way-to-get-context-on-android">Static Way to get Context on android?</a></p>

<p><a href="http://stackoverflow.com/questions/1026973/android-whats-the-difference-between-the-various-methods-to-get-a-context">Android - what&#39;s the difference between the various methods to get a Context?</a></p>

<p><strong>Description of problem:</strong></p>

<p>I have a set of utility classes, some of which write files. Others may use databases, etc. The point being that more than one of my utility classes need *<em>Context</em>*s. One trivial example is reading from the strings.xml via context.getString(r.strings.id). </p>

<p>I think in most cases I'd like to avoid singletons. Unless absolutely necessary i'll go with a singleton. This has been solved and posted on one of the links. I personally consider them an ati-pattern. Just a personal choice. I understand that your application context by definition is a singleton object. There is only one application for each app-context. I am open to go with the option described above if it is the only way.</p>

<p><strong>Question:</strong></p>

<p>How can my utility classes get acces to my app context such that I can simply do new MyContext(). This context needs to have a reference to the app resources. I think this is called applicationContext() when called from an activity. Ideally this would be a cheap operation. </p>

<p>Thank you.</p>

<p><strong>Edit:(clarification)</strong>
I'm writing a service that an application is going to bind itself to. I think this should not affect the answer. Thanks again.</p>
