I have a WebView in my Activity which I want to reuse across config
changes so that the webpage does not get reloaded after every
orientation change. I can use
Activity#onRetainNonConfigurationInstance/getLastConfigurationInstance
for this. However, I have heard that Fragment#setRetainInstance is
better for this purpose. This does not seem correct if there are other
Views involved which should be recreated after a config change (eg.
TextView which should be recreated after a locale change so that new
string resources can be picked up). I could keep only the WebView in a
Fragment, and all other Views in the Activity, but then either
approach seems good enough.

Just checking that Activity#onRetainNonConfigurationInstance/
getLastConfigurationInstance are not considered to be bad practice
going forward. 
http://developer.android.com/guide/topics/resources/runtime-changes.html
only mentions these apis anyway, not Fragment#setRetainInstance.

Thanks
Shri

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to