title: Android - execute thread repeatedly
body: <p>I am new to Android programming and Threads. I want to get a picture from a remote Server and display it. (that works so far ^^)
  But the picture is from a camera and so I need a new one as soon as I show the one I downloaded before. That means ,that the Thread should never stop grabbing the picture. (As long the Activity exists.)<br>
  Also I just want to establish 1 connection to the server and then just do HTTP-gets. So I have to have an parameter "connection" that the Thread can use.</p>
  
  <p>To get an idea - it should work something like this (but obviously it does not):</p>
  
  <pre><code>private class DownloadImageTask extends AsyncTask&lt;URLConnection, Void, Bitmap&gt; {
      /** The system calls this to perform work in a worker thread and
        * delivers it the parameters given to AsyncTask.execute() */
     private URLConnection connection = null;
      protected Bitmap doInBackground(URLConnection...connection ) {
          this.connection = connection[0];
          return getImageFromServer(connection[0]);
      }
      protected void onPostExecute(Bitmap result) {
          pic.setImageBitmap(result);
          this.doInBackground(connection);
      }
  }
  </code></pre>