A static variable is almost certainly not going to do what you want --
one of the big reasons for all of this is to be able to restore state
if the process is killed, and if you are putting stuff in a static
variable then that will all go away with the process when it is
killed.

Unfortunately it does look like there is an issue in TextView with
this, which I will need to think about how to fix.  There are a lot of
optimizations going on to avoid creating, saving, and restoring state
objects unless they are needed...  unfortunately this causes trouble
for people deriving from TextView.  Technically what you are supposed
to do is take the state object returned by the super class, write it
in your own state object, and hand it back to the super class when
restoring state.  The optimization to return null when there is no
state to save is breaking that.

One simple thing you could do is call TextView.setFreezesText() when
you are initializing your subclass.  This tells the text view it
should store its entire text in the state, which will force it to
always save its state.

On Nov 6, 5:07 pm, Craig <[EMAIL PROTECTED]> wrote:
> I have a workaround, but if anyone figures this out I'd love to see
> it.
>
> I have an inner static Parcelable class in my View to hold the view
> state. From my Activity's onSaveInstanceState, I create that
> Parcelable using a ctor that takes that View, and on my Activity's
> onRestoreInstanceState I call a method on my View that takes the
> Parcelable as an argument.
>
> This seems to work, and it's not terribly messy, but it doesn't seem
> quite right, either. Again, someone please post an example if you've
> figured this out already.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to