Show dialog from Application
<p>I have a class that extends <code>Application</code>, in the <code>onCreate</code> method I load some stuff from a DB and it doesn't make sense so do it asynchronously, because the app is useless without that data. 
1. problem: when the loading takes somes seconds, Android will show ANR. 
2. problem: can I show a dialog from the extended application class? </p>

<pre><code>pd = new ProgressDialog(this);
</code></pre>

<p>and</p>

<pre><code>pd = new ProgressDialog(getApplicationContext());
</code></pre>

<p>both resultet in </p>

<pre><code>E/AndroidRuntime(14168): java.lang.RuntimeException: Unable to create application com.example.skelett.GlobalApp: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
</code></pre>

<p>Should I probably do all the loading stuff in the <code>onCreate</code> method of my first <code>Activity</code>?
How can I prevent ANR when I <em>do</em> want to block the UI until my stuff is loaded?</p>
