Android: extending android.app.Application
<p>I have a DBHandler class that will be used in several activities to do some crud operations.  created a MyApp class (extends Application) to hold one instantiation of the DBHandler.</p>

<p>My DBHandler class needs a Context to create the SQLiteOpenHelper to populate the db, etc.</p>

<p>That's where the problem starts: in my MyApp constructor, I want to instantiate my DBHandler, so I wrote this:</p>

<pre><code>public MyApp() {
    super();
    dbh = DBHandler(&lt;WHAT DO I PASS HERE&gt;);
}
</code></pre>

<p>I tried getApplicationContext(), getBaseContext(), 'this'... nothing seems to be a fully-instantiated context at this point. I get a NPE when the SQLiteOpenHelper tries ctx.getResources(). </p>

<p>A workaround: create the DBHandler and set it in the onCreate of my main class. -> UGLY (call me a aesthetician)</p>

<p>Question: is there a way to do it when Android creates MyApp?</p>

<p>Thanks!</p>
