ProgressBar does not show immediately in android
<p>I have a base class of an activity and a sub class which extends the base class. The superclass has a async task to perform some action. I call this by running it on the ui thread since otherwise it throws an IllegalInitializerError:</p>

<pre><code>superclass.this.runOnUiThread(new Runnable() {
    public void run() {
        String p="";
        try {
            p=new asynctasker().execute().get();
        }
    }
}
</code></pre>

<p>In my async task:</p>

<pre><code>protected void onPreExecute()
{
    // TODO Auto-generated method stub
    super.onPreExecute();
    //showDialog();
    Log.d("Now","Inside right now");
    dialog = ProgressDialog.show(class_create_event.this, "Loading1", "Please Wait");
}
</code></pre>

<p>However the dialog is displayed almost at the end of the request. The I am in part is printed correctly. I know that something is blocking my ui thread. But if I dont call the async task from the UI thread it throws an illegal initializer error. Is there any way out?</p>
