Yes you can. There are two ways to achieve this.

1. Using/overriding onSaveInstanceState(Bundle bundle)/
onRestoreInstanceState(Bundle bundle) methods of the Activity you're
running and save your data there
or
2. Using/overriding the same functions (but with other parameters) of
the View element (i.e. the TextView).

For a beginner, the first option is easier to use, as you have a
Bundle object passed in the functions and is very quickly to
implement.
The second one is bit more advanced/requires some more coding, but is
good/necessary if you develop stand-alone/resuable widgets/Views.

For using the Activity onSaveInstanceState/onRestoreInstanceState
method, you can check out my blog for a small tutorial I wrote. If i
got more time again, i'd write one for the 2nd method too.

[SavedState: Preserve data when your Activity is recreated – Part 1]
http://tseng-blog.nge-web.net/blog/2009/02/27/savedstate-preserve-data-when-application-is-recreated/

The reason why everything is gone, is because on a screenflip your
Activity is destroyed and recreated. Because of this you need to save
important data (which is necessary to persists on recreating) into
this Bundle object and take it out when the app is recreated.

Hope it helps!
Tseng

On Mar 29, 4:20 am, Bobbie <bobbie.st...@gmail.com> wrote:
> I am putting text into a TextView that is inside of a ScrollView (so
> that they can scroll through the text) via the "append" command and
> HTTP posts.  When I switch views from vertical to horizontal (or vice-
> versa), all of the text in the TextView/ScrollView goes away, the data
> is not saved.  Is there a way I can save this data, or do I have to re-
> download it every time the user switches the screen back and forth?  I
> haven't been able to figure this out yet.  Thanks for any help you can
> give!
--~--~---------~--~----~------------~-------~--~----~
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