Call back method referring to old fragment
<p>I have a fragment activity that contains a Fragment , the Fragment starts an Asynctask that downloads some data, I have implemented a callback method in my Fragment that updates some values in an adapter and a listview. The problem I have is the following:  This is my onCreateView method(important part):</p>

<pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    list=(PullToRefreshListView)v1.findViewById(R.id.listapull);
    adapterList=new ListViewAdapter(secciones, mContext);
}
</code></pre>

<p>when I rotate the device while the AsyncTask is running, the doInBackground() method keeps running, then on post execute it triggers the listener and starts the callback method in my fragment, this method has the old references of my adapter and my list view:
<img src="http://i.stack.imgur.com/q7grP.png" alt="enter image description here"></p>

<p>The fragment and its content are recreated when an orientation change happens and that is correct,  but does anyone knows why the call back method is keeping the reference to the adapter and listview that where created before the orientation change?</p>

<p><strong>EDIT:</strong></p>

<p>I have a button that executes the asynctask like this:</p>

<pre><code>asyncRefresh = new PullRefreshTask(taskContext, mContext, secciones);
asyncRefresh.setUpdatePull2RefreshListener(this);
asyncRefresh.execute();
</code></pre>

<p>If the user press the button the asyncTask will set old Fragment as the listener and when an orientation change occurs while the asynctask is running, I thought the activated callback method  was the one from the newly created fragment method but I'm not sure anymore.</p>

<p><strong>EDIT 2:</strong></p>

<p>I have resolved my problem, as i said in my first edit the call back method was being called for the old fragment . so what I did was to save my asynctask in a variable in another class named "Info" and in on create view i did this:</p>

<pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        list=(PullToRefreshListView)v1.findViewById(R.id.listapull);
        adapterList=new ListViewAdapter(secciones, mContext);
        PullRefreshTasktask task = Info.getAsyncTask();
        asyncRefresh =  task;
        asyncRefresh.setUpdatePull2RefreshListener(this);
    }
</code></pre>

<p>This way I set the new reference of my fragment in my  </p>

<blockquote>
  <p>setUpdatePull2RefreshListener()</p>
</blockquote>

<p>method of the running asynctask </p>
