title: how to show progress dialog in oncreate in android app
body: <p>In onCreate() of the activity, I'm force changing the orientation of the activity from portrait to landscape. This is working but there is a small delay of about a sec in the emulator. This activity is actually one of the tabs. So when the user clicks on the tab he would expect an immediate response. So I want to show a progress dialog until the view is completely loaded. How do I  achieve this? I tried to do the below but it doesn't work,</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.chart);
  
      ProgressDialog dialog = new ProgressDialog(this);
      dialog.setMessage("Loading...");
      dialog.show();
  
      this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
      .
      .
      .
      dialog.dismiss();//after the view is loaded completely   }
  </code></pre>
  
  <p>Any suggestion is appreciated.</p>