title: AsyncTask kill task when back button pressed
body: <p>I am having a little problems with AsyncTask.</p>
  
  <p>I have it implemented as follows</p>
  
  <pre><code> private class MakeConnection extends AsyncTask&lt;String, Void, String&gt; implements OnDismissListener{
  
      Context context;
      ProgressDialog myDialog;
      public MakeConnection(Context conetext)
      {
          this.context = conetext;
          myDialog = new ProgressDialog(this.context);
          myDialog.setCancelable(true);
          myDialog.setOnDismissListener(this);
      }
  
      @Override
      protected String doInBackground(String... urls) {
          //do stuff
      }
  
      @Override
      protected void onPostExecute(String result) {
          try {
              myDialog.dismiss();
              success(result);
          }catch(JSONException e)
          {
              data = e.toString();
          }
      }
  
      @Override
        protected void onProgressUpdate(Void... values) {
              myDialog = ProgressDialog.show(context, "Please wait...", "Loading the data", true);
         }
  
      @Override
      public void onDismiss(DialogInterface dialog) {
  
          this.cancel(true);
      }
  }
  </code></pre>
  
  <p>But when ever I press the back button nothing happens, it just completes the task as if I didn't press the back button</p>
  
  <p>Any idea why?</p>