title: App crashes due to leaked window
body: <p>My app was working fine but all of sudden it crashes and this error is getting me more crazy.
  it was working well both on server and on local files. but now it crashes whenver i try to read file from server. </p>
  
  <p>My logcat is as follows:</p>
  
  <pre><code>ERROR/WindowManager(10324): Activity idtech.ESDN.Map has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41838b78 that was originally added here
          android.view.WindowLeaked: Activity idtech.ESDN.Map has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41838b78 that was originally added here
          at android.view.ViewRootImpl.&lt;init&gt;(ViewRootImpl.java:380)
          at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:292)
          at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)
          at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)
          at android.view.Window$LocalWindowManager.addView(Window.java:547)
          at android.app.Dialog.show(Dialog.java:277)
          at idtech.ESDN.Map$LoadFile.onPreExecute(Map.java:64)
          at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
          at android.os.AsyncTask.execute(AsyncTask.java:534)
          at idtech.ESDN.Map.onActivityResult(Map.java:241)
          at android.app.Activity.dispatchActivityResult(Activity.java:5194)
          at android.app.ActivityThread.deliverResults(ActivityThread.java:3180)
          at android.app.ActivityThread.handleSendResult(ActivityThread.java:3227)
          at android.app.ActivityThread.access$1100(ActivityThread.java:137)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:137)
          at android.app.ActivityThread.main(ActivityThread.java:4838)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:511)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
          at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Its showing that error is coming on async task which is as follows:</p>
  
  <pre><code>public class LoadFile  extends AsyncTask&lt;String,String,String&gt;
  {
      ProgressDialog Asycdialog = new ProgressDialog(Map.this);
  
  
      @Override
      protected void onPreExecute() {
          //set message of the dialog
  
          super.onPreExecute();
          Asycdialog.setMessage("Loading File");
          Asycdialog.setButton(DialogInterface.BUTTON_NEGATIVE,"Cancel",new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {
              }
          });
          //show dialog
         if (!Map.this.isFinishing())
         {
             Asycdialog.show();
         }
      }
  
      protected void onProgressUpdate(String ... progress)
      {
  
      }
  
      protected String  doInBackground(String ... Params)
      {
          Map.this.mGLView.LoadProjectFile(AppFuncs.g_path);
          Map.this.mGLView.requestRender();
  
  
          return null;
      }
      protected void onPostExecute(String result)
      {
          Asycdialog.dismiss();
  
          super.onPostExecute(result);
         }
  }
  </code></pre>