I would suggest instead saving the data in onPause() and restoring it in
onCreate().  (And if you are doing this, you should turn off the text view's
auto-saving of its data in the saved instance state, since you no longer
need that.)

On Tue, Sep 1, 2009 at 11:44 AM, Mark Murphy <[email protected]>wrote:

>
> pink 444 wrote:
> > Hai,
> >        I have a EditText filed in my Activity class,Where i need to
> > retain data,when orientation is changed or "HOME" button is pressed or
> > "BACK(FINISH)" is pressed.
> >
> >       Android internally maintaining EditText when orientation is
> > changed or HOME button is pressed .But it is not maintaining  EditText
> > status when BACK button is pressed.
> >
> >       How can i make it happen to retain data in all three cases
> > (orientation is changed,HOME is pressed, Back is pressed) in a
> > feasible way?
> >
> >
> >       Any help would be appreciated highly.
>
> Step #1: Implement onKeyDown() in your activity
>
> Step #2: Watch for KeyEvent.KEYCODE_BACK
>
> Step #3: When you get that event, save your data someplace, and still
> pass the key event to the superclass for processing
>
> Step #4: In onCreate(), if you are not passed a Bundle, look for the
> data wherever you stored in from Step #3
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 1.0 In Print!
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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