Streets Of Boston wrote: > Android guarantees that during a configuration change, no message will > be posted to 'the' activity inbetween an onDestroy and an onCreate (i > remember a post by Dianna about this). > > This means that the result from the onPostExecute either arrives > before the activity is destroyed or after it is created (during a > configuration change).
Another variation on the theme is to have the AsyncTask not be a regular inner class, but a static inner class or public class. Then, have the activity return the AsyncTask itself in onRetainNonConfigurationInstance(). The activity associates itself with the task via accessor methods, detaching from the task in onRetainNonConfigurationInstance() and re-attaching itself in onCreate(). I need to give this code a greater workout, but it hasn't failed me yet. http://github.com/commonsguy/cw-android/tree/master/Rotation/RotationAsync -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

