title: AsyncTask loop not executed after adding Listener
body: <p>I'm trying to get a response back from my public class saveData extends AsyncTask.</p>
  
  <p>For that I have added a <code>public interface OnTaskCompleted()</code>.But the for loop does not get executed and it is going straight from the for line to the return and <code>onPostExecute()</code> never get executed. If I remove the interface the loop it is working properly.</p>
  
  <p><em>My Activity:</em></p>
  
  <pre><code>public class almostFinish extends Activity{
  
  @Override 
  protected void onCreate(Bundle savedInstanceState) {
  }
  
  private void InvoiceSave(){
  SaveMyData savedata = new SaveMyData(new OnTaskCompleted() {
                          @Override
                          public void onTaskCompleted(boolean isSuccess) {
                              if(isSuccess){
                                  //do something
                              }
                              else {
                                  showMyAlert("Error Saving Invoice!");
                              }
  
                          }
                      });
                      List&lt;String&gt; myList = new ArrayList&lt;&gt;();
                      ...
                      savedata.execute(myList);
   }
  </code></pre>
  
  <p>My interface.</p>
  
  <pre><code>public interface OnTaskCompleted {
  void onTaskCompleted(boolean isSuccess);
  }
  </code></pre>
  
  <p>My AsyncTask class</p>
  
  <pre><code>public class SaveMyData extends AsyncTask&lt;List&lt;String&gt;, Void, Void&gt; {
      private OnTaskCompleted listener;
      boolean myflag = false;
  
   public SaveMyData (OnTaskCompleted listener){
      this.listener=listener;
  }
  
   @Override
  public void onPreExecute() {
      // TODO Auto-generated method stub
  }
  
  @Override
  protected Void doInBackground(List&lt;String&gt;... params) {
        for (int i = 1; i == 5; i++) {
        }
   return null;
  }
  
   @Override
  public void onPostExecute(Void result) {
      // TODO Auto-generated method stub
      super.onPostExecute(result);
  
          listener.onTaskCompleted(myflag);
  
  }
  }
  </code></pre>
  
  <p>Thanks for any help.</p>