On Thu, Jun 3, 2010 at 7:32 AM, Patrick <[email protected]> wrote:

> Is there a way or concept that I missed to tell activities (or the UI
> elements) to keep their status?
>

Yes - read the very detailed documentation on the Activity Lifecycle. You
need to handle saving and restoring your instance state. Look at
onSaveInstanceState and onRestoreInstanceState in particular.

On Thu, Jun 3, 2010 at 7:56 AM, Rajiv <[email protected]> wrote:

> You can reseted the value of the Text by using onConfigurationChanged
> method of the Activity.


On Mon, Jun 7, 2010 at 2:39 AM, Jeremy <[email protected]> wrote:

> If you don't want the os to handle a configuration change (like a screen
> rotation), you can use the android:configChanges="" tag in the manifest file
> to specify what config changes should be handled manually:
>

Patrick's problem is not the configuration changing - it's his app being
destroyed and recreated DUE TO the configuration change. Dealing with this
by handling the configuration changes is not the correct solution, though it
may work for this case.

If you do it this way your app will only survive an orientation change - it
will not survive being killed for other reasons. For example, if the user
leaves your app to go to another and comes back to you some time later,
without changing orientation, your app will have been destroyed and
recreated and none of your data will be restored.

I would suggest you use onSave- and onRestore- InstanceState - that's what
they're there for. Don't waste time handling orientation change if your app
doesn't call for it to then only solve a part of your problem.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

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