The back button pauses your current activity and pop it from the activity stack, so the previous activity will be shown. You don't have and in most cases you just shouldn't override this behaviour Basicly, if you're in your third activity and you press the home button, then relaunch the application the third activtiy will be shown Please, refer to Activity lifecycle.
The back button pauses your current activity and pop it from the activity stack, so the previous activity will be shown. You don't have and in most cases you just shouldn't override this behaviour. Basicly, if you're in your third activity and you press the home button, then relaunch the application the third activtiy will be shown.
Please, refer to Activity lifecycle.
Thanks Vladimir. But for me When I am in third activity and I press home button and then relaunching gives me first activity. Can you give a nudge where I would have gone wrong.
– David Nov 19 '10 at 17:58 could you please remove the code you posted in your question? I think it causes all your trouble. – Vladimir Ivanov Nov 19 '10 at 18:04.
When you are in your third activity and then press home button. The next time if you want your activity to start from the third activity, Long press the home button and then invoke the application from this list rather than launching it from launcher activity.
The key is using ActivityLifecycleCallbacks (note that this requires Android API level 14 (Android 4.0)). Just check if the number of stopped activities is equal to the number of resumed activities. If they're equal, your application is being backgrounded.
If there are more resumed activities, your application is in the foreground. The really nice thing about this method is that it doesn't have the asynchronous issues getRunningTasks() does, but you also don't have to modify every Activity in your application to set/unset something in onResumed()/onPaused(). It's just a few lines of code that's self contained, and it works throughout your whole application.
Plus, there are no funky permissions required either. OnStop() is not called in low memory situations; is that a problem here? Note that this method may never be called, in low memory situations where the system does not have enough memory to keep your activity's process running after its onPause() method is called.
The key here is "keep your activity's process running..." If this low memory situation is ever reached, your process is actually killed (not just your activity). This means that this method of checking for backgrounded-ness is still valid because a) you can't check for backgrounding anyway if your process is killed, and b) if your process starts again (because a new activity is created), the member variables (whether static or not) for MyLifecycleHandler will be reset to 0. Does this work for configuration changes?
Configuration changes (like screen rotation) do not pause/stop/destroy/recreate/etc. the activity. Do not check for backgrounding in your Activity's onPause() method. This is the wrong place to check for it.
Instead, you should check for backgrounding in onStop() after super.onStop(). If you need to check for backgrounding in onPause(), then you'll have to use a different method. The reason is because when onPause() is called, the next activity hasn't even been created (or started or resumed) yet, so as far as Android is concerned, your Activity is still in the foreground (though in the (near) future, that might change).
Testing for backgrounding in onPause() is like testing for something before it happens, which, obviously, doesn't really work, and so you are left to your own methods to work that issue out. My advice is to just design your app to check for backgrounding in onStop().
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.