title: onPostExecute() not working on re-run of asyncTask called from an activity
body: <p><strong>First time if I run my application then the control goes to onPostExecute() after doinBackground() is complete .But if I re run the application on the device without uninstalling then onPostExecute() is never executed.</strong></p>
  
  <p>I have an <strong>activity</strong> from where I am calling my asynTask .</p>
  
  <p><strong>CODE:</strong> </p>
  
  <pre><code>public class AddThing extends Activity {
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); 
  try {
              Class.forName("android.os.AsyncTask");
          } catch (ClassNotFoundException e) {
              e.printStackTrace();
          }
  private View.OnClickListener onSave = new View.OnClickListener() {
  startAddThingType2Task();
  }
  }
  private class ThingCallback implements ActionCallback {
  
          Context cntxt;
  
          public ThingCallback(Context context) {
              // TODO Auto-generated constructor stub
             this.cntxt = context;    
          }
  
          public void onSuccess(ArrayList&lt;?&gt; objects) {
  
              setProgressBarIndeterminate(false);
              Intent intent = new Intent(getApplicationContext(),DocketDetail.class);
  
              startActivityForResult(intent, 1);
          }
  
          public void onFailure(Exception exception) {            
              Toast.makeText(cntxt, "Unable to add docket. Error is: "+ exception.getMessage(), Toast.LENGTH_LONG).show();
          }       
      }
  private void startAddThingType2Task() {
  
  
              final AddThingType2 task = new AddThingType2(AddThing.this,new ThingCallback(this));
  
              runOnUiThread(new Runnable() {
  
                  public void run() {
                      // TODO Auto-generated method stub
                      task.execute();
  
                  }
              });
  }
  </code></pre>
  
  <p>My asyncTask Class is:</p>
  
  <pre><code>public class AddThingType2Task2 extends AsyncTask&lt;Void, Void, Boolean&gt; {
  
      public ActionCallback callback = null;
      private Context context;
      private Exception ePriv = null;
      private Activity activity;
  
      public AddThingType2(Activity activity,ActionCallback callback, ) {
          this.callback = callback;
          this.context = context;
          this.activity = activity;
  
      }
  
      @Override
      protected void onPostExecute(Boolean result) {
          // TODO Auto-generated method stub
          super.onPostExecute(result);
          if (result == true) {
              callback.onSuccess(null);
          } else {
              callback.onFailure(ePriv);
          }               
      }
  
      @Override
      protected Boolean doInBackground(Void... params) {
          // TODO Auto-generated method stub
  
  
          Boolean retval = false;
  
  
  
          try {
  
              retval = true;
              }
  
          } catch (Exception e) {
              Log.e("AddThingType2Task", e.getMessage());
              ePriv = e;
          }
  
          return retval;
      }
  
  }
  </code></pre>
  
  <p><strong>ActionCallback</strong> interface has two methods - <code>onSuccess()</code> and <code>OnFailure()</code> in it.</p>
  
  <p><strong>Edit</strong> 
  I'm using <strong>commonsware wakeful intent service</strong> also in my application .</p>
  
  <p>For the first time its working like charm but on re-run onpostExecute() not working... </p>
  
  <p>Please help !!</p>
  
  <p>Regards</p>
  
  <p>Upon re-run i am getting this in <strong>logcat</strong> :</p>
  
  <pre><code>09-20 17:37:28.515: W/MessageQueue(9311): Handler{4060df08} sending message to a Handler on a dead thread
  09-20 17:37:28.515: W/MessageQueue(9311): java.lang.RuntimeException: Handler{4060df08} sending message to a Handler on a dead thread
  09-20 17:37:28.515: W/MessageQueue(9311):   at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196)
  09-20 17:37:28.515: W/MessageQueue(9311):   at android.os.Handler.sendMessageAtTime(Handler.java:457)
  09-20 17:37:28.515: W/MessageQueue(9311):   at android.os.Handler.sendMessageDelayed(Handler.java:430)
  09-20 17:37:28.515: W/MessageQueue(9311):   at android.os.Handler.sendMessage(Handler.java:367)
  09-20 17:37:28.515: W/MessageQueue(9311):   at android.location.LocationManager$ListenerTransport.onStatusChanged(LocationManager.java:206)
  09-20 17:37:28.515: W/MessageQueue(9311):   at android.location.ILocationListener$Stub.onTransact(ILocationListener.java:75)
  09-20 17:37:28.515: W/MessageQueue(9311):   at android.os.Binder.execTransact(Binder.java:320)
  09-20 17:37:28.515: W/MessageQueue(9311):   at dalvik.system.NativeStart.run(Native Method)
  </code></pre>