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

