title: Running multiple AsyncTasks at the same time -- not possible?
body: <p>I'm trying to run two AsyncTasks at the same time. (Platform is Android 1.5, HTC Hero.)
  However, only the first gets executed. Here's a simple snippet to describe my problem:</p>
  
  <pre><code>public class AndroidJunk extends Activity {
   class PrinterTask extends AsyncTask&lt;String, Void, Void&gt; {
       protected Void doInBackground(String ... x) {
        while (true) {
         System.out.println(x[0]);
         try {
          Thread.sleep(1000);
         } catch (InterruptedException ie) {
          ie.printStackTrace();
         }
        }
          }
      };
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          new PrinterTask().execute("bar bar bar");
          new PrinterTask().execute("foo foo foo");
  
          System.out.println("onCreate() is done.");
      }
  }
  </code></pre>
  
  <p>The output I expect is:</p>
  
  <pre><code>onCreate() is done.
  bar bar bar
  foo foo foo
  bar bar bar
  foo foo foo
  </code></pre>
  
  <p>And so on. However, what I get is:</p>
  
  <pre><code>onCreate() is done.
  bar bar bar
  bar bar bar
  bar bar bar
  </code></pre>
  
  <p>The second AsyncTask never gets executed. If I change the order of the execute() statements, only the foo task will produce output.</p>
  
  <p>Am I missing something obvious here and/or doing something stupid? Is it not possible to run two AsyncTasks at the same time?</p>
  
  <p>Edit: I realized the phone in question runs Android 1.5, I updated the problem descr. accordingly. I don't have this problem with an HTC Hero running Android 2.1. Hmmm ...</p>