title: Is setting a global Context in a class bad practice?
body: <p>If I pass a context in the constructor of an object, could that potentially cause a memory leak if the object being created is a long lived object or a singleton. Example below.</p>
  
  <pre><code>public class MyObject{
      private final Context context;
  
      public MyObject(Context context){
          this.context=context;
      } 
  }
  </code></pre>
  
  <p>Would it be preferable to set the context from getApplicationContext() as that returns a singleton of the application class as opposed to the context from the instance of the referencing class like so?</p>
  
  <pre><code>context =  context.getApplicationContext();  
  </code></pre>