title: How to properly use AsyncTask
body: <p>I want to capture a frame buffer from a camera surface preview and send those buffers to another function to be processed / POSTed somewhere on the web. </p>
  
  <p>The Android Dev guide gives this example:
  <a href="http://developer.android.com/reference/android/os/AsyncTask.html" rel="nofollow">http://developer.android.com/reference/android/os/AsyncTask.html</a></p>
  
  <pre><code> private class DownloadFilesTask extends AsyncTask&lt;URL, Integer, Long&gt; {
       protected Long doInBackground(URL... urls) {
           int count = urls.length;
           long totalSize = 0;
           for (int i = 0; i &lt; count; i++) {
               totalSize += Downloader.downloadFile(urls[i]);
               publishProgress((int) ((i / (float) count) * 100));
           }
           return totalSize;
       }
  
       protected void onProgressUpdate(Integer... progress) {
           setProgressPercent(progress[0]);
       }
  
       protected void onPostExecute(Long result) {
           showDialog("Downloaded " + result + " bytes");
       }
  }
  </code></pre>
  
  <p>Here's how you execute it:</p>
  
  <pre><code>new DownloadFilesTask().execute(url1, url2, url3);
  </code></pre>
  
  <p>Is this entire operation one big AsyncTask (in other words, is that loop going to sit there and wait for each file to download synchronously) while the entire task works in the background, or is this going to start up multiple threads for each URL that was passed?</p>
  
  <p>Related to my project, would it be reasonable to simply create a brand new AsyncTask every single time I want to capture a frame buffer? Something along the lines of:</p>
  
  <pre><code>//for each frame buffer i want to process:
      new FrameProcessorTask().execute(byte[]);
  </code></pre>