android don't restart thread when orientation changes
<p>my apps was based on this code <a href="http://www.41post.com/4588/programming/android-coding-a-loading-screen-part-1" rel="nofollow">http://www.41post.com/4588/programming/android-coding-a-loading-screen-part-1</a> .on the doInBackground my app will connect to the internet and download some data and populate the database and it will usually take some time to complete. the problem is when the orientation changes, the doInBackground function is restarted and it will cause problems.</p>

<p>I referred <a href="http://developer.android.com/guide/topics/resources/runtime-changes.html" rel="nofollow">http://developer.android.com/guide/topics/resources/runtime-changes.html</a> and it says to do something like </p>

<pre><code>@Override
public Object onRetainNonConfigurationInstance() {
    final MyDataObject data = collectMyLoadedData();
    return data;
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final MyDataObject data = (MyDataObject) getLastNonConfigurationInstance();
    if (data == null) {
        data = loadMyData();
    }
    ...
}
</code></pre>

<p>but on my apps, I don't know what should I put under the onRetainNonConfigurationInstance() because as you can see from the codes at <a href="http://www.41post.com/4588/programming/android-coding-a-loading-screen-part-1" rel="nofollow">http://www.41post.com/4588/programming/android-coding-a-loading-screen-part-1</a> I called a class instead of functions..</p>
