Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How the new Activity get the result from the request launched by the old activity? #70

Open
lightSky opened this issue Oct 11, 2014 · 0 comments

Comments

@lightSky
Copy link

Hello Matthias,

Thanks for your efforts in humanizing the Android development! I have a question though.
I have look through your source code of BetterAsycnTask ,and confuse that how it sent the result to the new activity.If user rotates the screen, a new activity is recreated.so the context of old activity is null.
But I see that you check the context in onPreExecute and if the context is null , the request will be cancelled ,and also check it in onPost mothod.I am agree with your point that it can avoid the repeat request when user flip the screen back and forth successfully.Beacause it is still the same activity.
And you said the task keeps track of the "active" instance of the context that launched it in your blog(http://brainflush.wordpress.com/2009/11/16/introducing-droid-fu-for-android-betteractivity-betterservice-and-betterasynctask/).
So it belongs to the activity that lanched it,If the activity is destory,the context is null.and the task is unuseful.but the new activity how get the result ?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant