title: use of asynctask inside asynctask
body: <p>I wanted to use AsyncTask to load images to the ListView. </p>
  
  <pre><code>private class LoadImageTask extends AsyncTask&lt;HashMap&lt;String,Bitmap&gt;,Void,Bitmap&gt;{
  
      @SuppressWarnings("unchecked")
      @Override
      protected void onPostExecute(Bitmap result) {
  
                 if(model.getIconCache().get(cellIcon)!=null){
                     icon.setImageBitmap(model.getIconCache().get(cellIcon));
                  }else{
                      new LoadImageTask().execute(model.getIconCache());
  
                  }
  
  
      }
  
      @Override
      protected Bitmap doInBackground(HashMap&lt;String, Bitmap&gt;... params) {
          //return model.getIconCache().get(cellIcon);
          return null;
  
      }
  
  }
  </code></pre>
  
  <p>Ok, I know that this not an affective code. However it works well but with a lot of memory allocation. When reading the documentation about AsyncTask it said that Asynctask can be called only from UI thread, how could it let to use inside itself? And of course I want to make my code work inside a single AsyncTask. "model" in the code is an object that is updated at runtime through another thread. So I need to find a way to use a single Asynctask with periodically control the state of an object. How do I do that? Thanks</p>