Replying back to the list, where this belongs: On Thu, Aug 23, 2012 at 4:35 AM, Andy <[email protected]> wrote: > > W dniu środa, 22 sierpnia 2012 23:14:24 UTC+2 użytkownik Mark Murphy (a > Commons Guy) napisał: >> >> No, the activity is destroyed if the user presses the BACK button, at >> least normally. > > Well, my app counts down some time choosen by a user and then plays a > ringtone.
There are many, many apps on the Play Store that do this already. > When a user presses back key while countdown, after a some time > one can ALWAYS hear a ringtone, but there is no way to return to the > application. So, you have a bug in your app. If the user presses BACK, one of two things should happen: 1. The countdown stops 2. The countdown continues, where the countdown is managed by a service, possibly with an associated Notification to allow the user to launch an activity to stop the countdown > When I launch the app second time I see that there is 2 > instances of the app (I'm using getInstancesCount() ). First, app != activity. They are not even spelled the same. Second, getInstanceCount() has been removed from the SDK, and so your app will crash on API Level 11+. > My problem is how to get back to this "frozen" app instead of launching its > new instance. You can't. Your first instance of the activity leaked stuff. Don't do that. If you wish the countdown to continue past a BACK press, have the countdown by managed by a service, such that a new activity can then tell the service to stop, etc. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- 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

