title: problem with Context "getApplicationContext()' on a null object reference"
body: <p>I made nonActivity class, and I use there other nonActivity Database class. When I call method from 1st class I have Error </p>
  
  <p><code>java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference</code></p>
  
  <p>Here is a fragment of my code of both classes: </p>
  
  <p>DataBase.java</p>
  
  <pre><code> public DataBase(Context context) {
          super(context, DATABASE_NAME, null, TABLE_VERSION);
     }
  </code></pre>
  
  <p>and ObliczPodatki.java</p>
  
  <pre><code>public class ObliczPodatki extends Application
  .
  .
  .
  myDb = new DataBase(this.getApplicationContext());
  </code></pre>
  
  <p>and the full error message: </p>
  
  <pre><code>Process: com.example.nadgraniav01, PID: 11274
      java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
          at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:116)
          at com.example.nadgraniav01.ObliczPodatki.obliczPodatki(ObliczPodatki.java:43)
          at com.example.nadgraniav01.DodajNadgranieActivity$2.onClick(DodajNadgranieActivity.java:99)
          at android.view.View.performClick(View.java:6669)
          at android.view.View.performClickInternal(View.java:6638)
          at android.view.View.access$3100(View.java:789)
          at android.view.View$PerformClick.run(View.java:26145)
          at android.os.Handler.handleCallback(Handler.java:873)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:193)
          at android.app.ActivityThread.main(ActivityThread.java:6863)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
  </code></pre>
  
  <p>if I use this instead of this.getApplicationContext() I am getting following erroe</p>
  
  <pre><code>Attempt to invoke virtual method 'java.io.File android.content.Context.getDatabasePath(java.lang.String)' on a null object reference 
  </code></pre>