title: execute asynctask multiple times or parallel in a loop
body: <p><strong>Code</strong></p>
  
  <pre><code>  for (int i=0;i&lt;imagesURL.length();i++)
      {
          final JSONObject obj = imagesURL.getJSONObject(i);
         // obj1.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,obj.getString("source"));
          obj1.execute(obj.getString("source")).get();
  
      }
  </code></pre>
  
  <p>I have tried </p>
  
  <blockquote>
    <p>AsyncTask.THREAD_POOL_EXECUTOR</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>.execute.get();</p>
  </blockquote>
  
  <p>but the asynctask cause execption. i just want to execute this loop completely and when 1st task execute completely then next execute.</p>
  
  <p><strong>Error</strong></p>
  
  <pre><code>Process: com.dexquad.posttracker, PID: 11481
                                                                       java.lang.IllegalStateException: Cannot execute task: the task is already running.
                                                                           at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:593)
                                                                           at android.os.AsyncTask.execute(AsyncTask.java:551)
                                                                           at com.dexquad.posttracker.TimelineActivity.processUserPhotosResult(TimelineActivity.java:224)
                                                                           at com.dexquad.posttracker.TimelineActivity$4.onCompleted(TimelineActivity.java:181)
                                                                           at com.facebook.GraphRequest$5.run(GraphRequest.java:1380)
                                                                           at android.os.Handler.handleCallback(Handler.java:739)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                           at android.os.Looper.loop(Looper.java:148)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                           at android.app.ActivityThreadHook.handleMain(ActivityThreadHook.java:27)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>