Tuesday, October 4, 2011

Re: [android-developers] Re: runOnUIThread method in doInBackground of Async Task...

You're right that was  a mistake while copying the code to here, its currently like this:

@Override
protected String doInBackground(Void... params) {
return activity.updateResultsInUi();
}

its the instance of the activity that is pased in the constructor.


On Tue, Oct 4, 2011 at 7:18 PM, TreKing <trekingapp@gmail.com> wrote:
2011/10/4 João Rossa <joao.rossa@gmail.com>
I posted the code there..there are no static methods,

You have

public abstract class ParentActivity extends Activity

Then in your separate AsyncTask class you have:

@Override
protected String doInBackground(Void... params) {
return ParentActivity.updateResultsInUi();
} 

Maybe I'm missing something but that looks like you're using a static method.

anyway how do i save the activity(as in the views that are filled) either on rotation while and after the task is running?

You don't - you re-associate your running AsyncTask with the new Activity and tell it to refresh the views on that new instance.


-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment