 <p>The <code>getApplication()</code> method is located in the <code>Activity</code> class, so whenever you want <code>getApplication()</code> in a non activity class you have to pass an <code>Activity</code> instance to the constructor of that non activity class.</p> <p>assume that test is my non activity class:</p> <pre><code>Test test = new Test(this); </code></pre> <p>In that class i have created one constructor:</p> <pre><code> public Class Test { public Activity activity; public Test (Activity act) { this.activity = act; // Now here you can get getApplication() } } </code></pre>