With regards to REST operations on Android, I guess most will have seen how Google I/O App 2010 (not 2011!) uses a IntentService + ResultReceiver pattern.
Now I'm wondering the rationale behind clearing the reference to the Activity in onRetainNonConfigurationInstance for Google I/O App.
@Override
public Object onRetainNonConfigurationInstance() {
// Clear any strong references to this Activity, we'll reattach to
// handle events on the other side.
mState.mReceiver.clearReceiver();
return mState;
}
My understanding is that onRetainNoNConfigurationInstance will only be invoked as a result of a configuration change. If so, will clearing the reference to the receiver in onPause(), as stated here, be better?
Another question I have with regards to this: assuming I were to forget to clear the reference to the activity in onPause()/onRetainNonConfigurationInstance(), can I say that as long as my Activity is not destroyed (meaning it is active, paused, or stopped), onReceiveResult() will still be called and my Activity updated?