title: Executing Multiple AsyncTask's Parallely
body: <p>I'm using Android SDK 4.0.3 API15 and I want to run multiple AsyncTasks parallely. I'm getting my data from web server and animating(10 fps) it real-time. But depending on user operations I need to send some data to web server also. When this occurs my animation pauses for a short time (sending data gets into queue and getting data waits it to finish ) and therefore I can't catch the real-time.</p>
  
  <p>This <a href="https://stackoverflow.com/a/4072832/1465931" title="answer">answer</a> is quite explaining but I couldn't make it work. So any help will be very appreciated.</p>
  
  <p>I think I need to use this function to achieve that:</p>
  
  <pre><code>AsyncTask.executeOnExecutor(Executor exec, Params... params)
  </code></pre>
  
  <p>But I can't pass an executor as a parameter and I can't instantiate an executor. This is my AsyncTask class:</p>
  
  <pre><code>public class GetPlayers extends AsyncTask&lt;String, Void, String&gt; {
      @Override
      protected String doInBackground(String... urls) {
  
          Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
  
          rawData="";
          for (String url : urls) {
              DefaultHttpClient client = new DefaultHttpClient();
              HttpGet httpGet = new HttpGet(url);
              try {
                  HttpResponse execute = client.execute(httpGet);
                  InputStream content = execute.getEntity().getContent();
  
                  BufferedReader buffer = new BufferedReader(new InputStreamReader(content));
                  if((rawData = buffer.readLine()) == null){
                      rawData = "error";
                  }
  
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
          return rawData; 
      }
  
      @Override
      protected void onPostExecute(String result) {
          manipulate();
      }
  }
  </code></pre>
  
  <p>And I execute it like this:</p>
  
  <pre><code>GetPlayers task = new GetPlayers();
  requestString = "web adress is here...";
  task.execute(new String[] { requestString });
  </code></pre>