title: Application Context in Non Activity Class?
body: <p>There is alot of info on this topic but none of it assist me.
  I have several global variables/fields inside the app's application class:</p>
  
  <pre><code>public class App extends Application {
  
  private static App instance
  
  public string PUBNUB_SUB = BuildConfig.PUBNUB_SUB_KEY; 
  public string PUBNUB_PUB = BuildConfig.PUBNUB_PUB_KEY;
  
  
  public void onCreate() {
  instance = this;
  
  }
  
  public static App getInstance(){
     return instance;
  }
  
  }
  </code></pre>
  
  <p>In Activities/Fragments I'm successfully accessing those variables like so:</p>
  
  <pre><code>class ActivityA extend Activity {
  
  App baseApp;
  Pubnub pubnub;
  
  
  public void onCreate(Bundle savedInstanceState){
  
       baseApp = new(App)getApplicationContext();
       Pubnub(baseApp.PUBNUB_SUB, baseApp.PUBNUB_PUB)
  
  }
  </code></pre>
  
  <p>Now How do I access getApplicationContext() in a non-Activity/non-Fragment Class?</p>
  
  <pre><code> public class Events {
  
  
   App baseApp;
   Context mContext;
   app = new(LoQooApp)mContext.getApplication(); ???
  
  
   public Events(Context context) {
   app = new(LoQooApp)mContext.getApplication(); ???
   }
  </code></pre>
  
  <p>The above doesnt work, where should </p>
  
  <p>app = new(LoQooApp) getApplication(); go?</p>