> If I press the 'home' key, onPause and onStop are called. Correct.
> If I press the 'back' key, in addition onDestroy is called (that's the > behaviour that has confused me). Correct. BACK, by default, will destroy your activity. > If I restart the activity by 'long pressing' the home key, onStart and > onResume are called. I haven't tested that, but I'll take your word for it. > If I restart the activity from the app menu, it is entirely restarted > with onCreate, leaving the other instance of the same activity in the > background. (Again, this is the behaviour that has confused me). This can be adjusted via some manifest settings. > So... is there a way to ensure that only one instance of the activity > can be run, so that when (and however) I start it, if it's already > running that is the one that continues? android:launchMode="singleTop" may do it, but may not be your problem. In most cases, you should not care about that other activity "in the background". It will be destroyed eventually, when the Grim Memory Reaper comes around. My problem is that I have no idea what you're trying to achieve, which limits my answers to very tactical ones, directly addressing your *questions* and not your core *problem*. For example, from your original post on this thread: "What I want is for a user action (button press etc) to start the service, which it does. Then I want the user, some time later, to press another button to stop the service. Which it does." None of that requires bindService() at all. Use startService() when the user starts the service. Use stopService() when the user stops the service. I have yet to figure out why you're messing with bindService() at all -- not that there aren't reasons to use bindService(), but the pattern you describe doesn't need it. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html -- 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

