title: Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@46029dd0
body: <p>I am developing an feedback kind of application, when I click the "submitnow" button      I am getting the following error  </p>
  
  <p>Activity has leaked window   </p>
  
  <pre><code>com.android.internal.policy.impl.PhoneWindow$DecorView@46029dd0
  </code></pre>
  
  <p>Following is my code, please help me out.</p>
  
  <pre><code>public class SignOut_Activity extends SherlockActivity implements
          OnClickListener {
  
      Button btnSubmitNow, btnSubmitLater;
      ProgressDialog progressDialog;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          setContentView(R.layout.signout);
  
          ((TextView) findViewById(R.id.tvSubTitle))
                  .setText(StoresListAdapter.StoreName);
  
          btnSubmitNow = (Button) findViewById(R.id.btnSubmitNow);
          btnSubmitLater = (Button) findViewById(R.id.btnSubmitLater);
  
          btnSubmitNow.setOnClickListener(this);
          btnSubmitLater.setOnClickListener(this);
  
          progressDialog = new ProgressDialog(SignOut_Activity.this);
          progressDialog.setMessage("Uploading data, please wait...");
  
      }
  
      @Override
      public boolean onOptionsItemSelected(
              com.actionbarsherlock.view.MenuItem item) {
  
          switch (item.getItemId()) {
          case android.R.id.home:
              // app icon in action bar clicked; finish activity to go home
              finish();
              break;
  
          default:
              break;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      @Override
      public void onResume() {
          super.onResume();
          // Set title
          getSupportActionBar().setTitle("Sign Out");
  
      }
  
      @Override
      public void onClick(View v) {
  
          switch (v.getId()) {
          case R.id.btnSubmitNow:
              // Submit now
  
              // Sample upload image
              UploadImage.uploadImage("testimage");
  
              new AsyncTask&lt;Void, Void, Void&gt;() {
  
                  // called before execution // main/UI thread
                  protected void onPreExecute() {
                      progressDialog.show();
                  };
  
                  @Override
                  protected Void doInBackground(Void... params) {
                      // Submit the store data
                      StoreData.postData(StoreList_Activity.storesList
                              .get(StoresListAdapter.Position));
                      return null;
                  }
  
                  // on store data uploaded // main/UI thread
                  protected void onPostExecute(Void result) {
                      progressDialog.dismiss();
                      setSignOut();
                      StoreList_Activity.storesList
                              .get(StoresListAdapter.Position).isSubmitted = true;
                      SignOut_Activity.this.finish();
                  };
  
              }.execute();
  
              break;
          case R.id.btnSubmitLater:
              // Submit later
              setSignOut();
              StoreList_Activity.storesList.get(StoresListAdapter.Position).isSubmitLater = true;
              VisitOps_Activity.isSubmitLater = true;
              SignOut_Activity.this.finish();
  
              break;
  
          default:
              break;
          }
  
      }
  
      @SuppressLint("SimpleDateFormat")
      private void setSignOut() {
  
          VisitOp visitOp10 = new VisitOp();
          visitOp10.setName("Sign Out");
          visitOp10.setStatus("");
          SampleData.visitOpsList.add(visitOp10);
  
          if (VisitOps_Activity.VisitOps.SignOut == null)
              VisitOps_Activity.VisitOps.SignOut = new SignOut();
  
          SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
          String currentDateandTime = sdf.format(new Date());
  
          VisitOps_Activity.VisitOps.SignOut.SignOutTime = "Out: "
                  + currentDateandTime;
  
      }
  }
  </code></pre>