[android-beginners] Re: onSaveInstanceState question

2009-09-14 Thread Yusuf Saib (T-Mobile USA)
Google root your phone model. Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Sep 12, 9:20 am, aamod rao

[android-beginners] Re: onSaveInstanceState question

2009-09-12 Thread aamod rao
can anyone of u help me to root my phone? On Sep 12, 6:35 am, Mark Murphy mmur...@commonsware.com wrote: jason wrote: Is there a way for an (sub-)activity to pass values to the previous activity on the stack (when Back key is pressed) without resorting to persistence storage or static

[android-beginners] Re: onSaveInstanceState question

2009-09-11 Thread Mark Murphy
jason wrote: How does one then save and restore the application state when the Back key is pressed and then the application is brought to foreground? When the BACK button is pressed, the currently-running activity is destroyed, not put in the background. If you wish to save something when

[android-beginners] Re: onSaveInstanceState question

2009-09-11 Thread Jose Ayerdis
You are so right!! 2009/9/11 Mark Murphy mmur...@commonsware.com jason wrote: How does one then save and restore the application state when the Back key is pressed and then the application is brought to foreground? When the BACK button is pressed, the currently-running activity is

[android-beginners] Re: onSaveInstanceState question

2009-09-11 Thread Mark Murphy
Mark Murphy wrote: If you wish to save something when the activity is being destroyed, implement onDestroy() and save it. Where you save it (flat file, SharedPreferences, database, the Internet) is up to you. Bear in mind that onDestroy() may also be called in the case of a screen rotation

[android-beginners] Re: onSaveInstanceState question

2009-09-11 Thread jason
Thanks, Mark. Hmm, pressing the Back key so easily kills the activity. Is there a way to trap Back key within an application and prevent/control this behavior? For sub-activity screens, does the Back key have the same behavior (killing the app/activity) or does it go back to the parent activity

[android-beginners] Re: onSaveInstanceState question

2009-09-11 Thread Mark Murphy
jason wrote: Is there a way to trap Back key within an application and prevent/control this behavior? Implement onKeyDown() in your activity and watch for KeyEvent.KEYCODE_BACK. Please bear in mind that your users will get irritated if you make it difficult for them to navigate your

[android-beginners] Re: onSaveInstanceState question

2009-09-11 Thread jason
Thanks, Mark. That was helpful. If you are referring to activities started by one of your activities via startActivity(), then, yes, the BACK button behaves the same. The BACK button's job is to destroy the current activity and return control to the previous activity on the stack. Is there

[android-beginners] Re: onSaveInstanceState question

2009-09-11 Thread Mark Murphy
jason wrote: Is there a way for an (sub-)activity to pass values to the previous activity on the stack (when Back key is pressed) without resorting to persistence storage or static varables in the app? Use startActivityForResult() rather than startActivity() to start it, use setResult() to