The user changing the language is a config change (likely rare, except for developers testing localization, but still).

Possibly more commonplace, docking (and undocking), is a config change.

Back to the original topic: Andorid automatically saves and restores those views that have an ID. If a view has the default ID value of -1 (either not assigned in XML or not set in code), it's state is not saved.

And IIRC, TextView by default doesn't save or restore state even if there is an ID. Setting android:freezesText="true" in XML or calling setFreezesText(true) from code is supposed to force saving, but I've never tried it myself.


       public voidsetFreezesText(boolean freezesText)

Since:API Level 1 <http://developer.android.com/guide/appendix/api-levels.html#level1>

Control whether this text view saves its entire text contents when freezing to an icicle, in addition to dynamic state such as cursor position. By default this is false, not saving the text. Set to true if the text in the text view is not being saved somewhere else in persistent storage (such as in a content provider) so that if the view is later thawed the user will not lose their data.


-- Kostya

09.10.2011 1:25, TreKing ?????:

And I quote:
*"Note:* Using this attribute should be avoided and used only as a last-resort. Please read Handling Runtime Changes <http://developer.android.com/guide/topics/resources/runtime-changes.html> for more information about how to properly handle a restart due to a configuration change."

It really seems to me that you're the one ignoring some important details. You are advising the OP to use this solution to solve his state problem which is clearly documented as not being the correct thing to do.

--
Kostya Vasilyev

--
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