title: AsyncTask with ListView
body: <p>I am using a customListAdapter ( extends BaseAdapter) in my application. I have used this adapter inside a ListFragment.</p>
  
  <p>For prototyping I have hard-coded some values in a string array and used those to populate the lists. I am overriding getView and returning the view after inflating.</p>
  
  <p>Now I need to get some data from my webservice call, which I am planning to do inside an AsyncTask. </p>
  
  <p>What is the recommended way to do this? </p>
  
  <p><strong>Current Code ( Pseudo )</strong></p>
  
  <pre><code>public class customListAdapter extends BaseAdapter {
  
    @Override
    public View getView(int position, View MyconvertView, ViewGroup parent) {
  
      // Inflating view 
      // Other view operations
      return MyconvertView;
    }
  
    class SomeTask extends AsyncTask&lt;params,progress ,Result &gt; {
  
    @Override
    protected View doInBackground(... params) {
    }
  
  
    @Override
          protected void onPostExecute(View result) {
  
          }
    }
   }
  }
  </code></pre>
  
  <p><strong>Modification required:</strong></p>
  
  <p>Option 1: </p>
  
  <pre><code>  @Override
    public View getView(int position, View MyconvertView, ViewGroup parent) {
  
      // Inflating view 
      // Other view operations
  
      return new SomeTask.execute(); // should return the view , the onPostExecute of SomeTask should return this. 
    }
  </code></pre>
  
  <p>Option 2:</p>
  
  <p>Please suggest.</p>