title: progressdialog going behind a dialog
body: <p>I have created dialog and it inflates xml which gets updated with the info  .But the progress dialog is shown behind the dialog which pops up .How do I show those progressdialog on top of dialog with inflated xml.</p>
  
  <pre><code>public class MainActivity extends Activity {
  
       protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
  
  
             dialog();
          }
  
  
          public class loadasync extends AsyncTask&lt;Void, Void, JSONObject&gt; {
  
              ProgressDialog progressDialog ;
              @Override
              protected JSONObject doInBackground(Void... params) {
                      }
              @Override
              protected void onPreExecute() {
                  // TODO Auto-generated method stub
  
                  super.onPreExecute();
                  runOnUiThread(new Runnable() {
                      @Override
                      public void run() {
                            progressDialog = new ProgressDialog(MainActivity.this);
                          progressDialog.setMessage("loading");
                          progressDialog.setCanceledOnTouchOutside(false);
                          progressDialog.show();
                      }
                  });         
              }
  
              @Override
              protected void onPostExecute(JSONObject result) {
  
  
                  runOnUiThread(new Runnable() {
                      @Override
                      public void run() {
  
  
                           progressDialog.dismiss();   
                      }       
                  });
              }
          }   
  
  
  
          public void dialog() {
  
              dialog = new Dialog(MainActivity.this);
               dialog.setContentView(R.layout.dialogxml);
  
          loadasync loadasyncdata=new loadasync();
          loadasyncdata.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  
  
              dialog.show();
  
  
          }
  </code></pre>