Re: [android-developers] Re: restart application after Android's killed it
On Thu, Jul 21, 2011 at 4:12 PM, nadam ad...@anyro.se wrote: This is not true for my devices. At least not after manually destroying an app using a task manager. I get the same behavior from launcher icon and back button. On HTC Hero with Android 2.1, I always end up in the launcher activity. On Nexus S with Android 2.3.4 and Motorola Xoom with Android 3.0.1, I always end up in the last activity that was displayed. Starting with 2.2 task managers can only kill background processes, doing the same thing the low memory killer does. Prior to 2.2, they could do a full force stop which would whack the state of the application. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: restart application after Android's killed it
mmm I think that you need to save all that data via shared preferences (or something like that) when your app is about to be killed. You can check the javadoc for Activity#onPause() and the Spinner sample that comes with the SDK. On Wed, Jul 20, 2011 at 10:56 AM, Fina Perez fina.pere...@gmail.com wrote: Well, the problem is that when the program is killed, due to android policies or because of an error, sometimes the program is restarted in the last activity that was displayed. In my application, when this happens, I have an error and the program is force to close because I'm missing some data that I dont have if the program is restarted in that activity. So I would like, in that case, to force the program to restart in my main activity. I'm using MVPC (Model view presenter controller), so if Android restarts in the last activity, some data dont exists, that's why I would like to restarts in the main activity. On Jul 20, 3:24 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 20, 2011 at 7:02 AM, Fina Perez fina.pere...@gmail.com wrote: As far as I know, Android kills an application after sometime if the user is not interacting with it, in order to save memory. If the user goes back to the application, the last activity is displayed again. That depends on how the user goes back to the application. If they click on the launcher icon, they will go to the launcher activity. If they navigated back to the destroyed activity via the BACK button or something like that, they will go to that specified activity. What I would like to do is that when this situations occurs, I always would like to restart from my main activity. But only if my application was killed, not in other scenarios. Why? -- Mark Murphy (a Commons Guy)http://commonsware.com| http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: restart application after Android's killed it
Then you have a bug that needs to be fixed. Putting band-aids over broken code is likely to make it only worse in the long run. Try initializing your data on-demand, so it's available to any activity that may need it. FWIW, there a manifest flag that resets the stack to the main activity, but it does this every time, crash or not. And killed because of an error sounds like more bugs that need to be fixed. -- Kostya 20.07.2011 17:56, Fina Perez пишет: Well, the problem is that when the program is killed, due to android policies or because of an error, sometimes the program is restarted in the last activity that was displayed. In my application, when this happens, I have an error and the program is force to close because I'm missing some data that I dont have if the program is restarted in that activity. So I would like, in that case, to force the program to restart in my main activity. I'm using MVPC (Model view presenter controller), so if Android restarts in the last activity, some data dont exists, that's why I would like to restarts in the main activity. -- Kostya Vasilyev -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: restart application after Android's killed it
That has nothing to do with what happens when the process is killed. Processes being killed in the background is invisible to the user. The UI flow they go through is absolutely not intended to change just based on whether a process is killed, because it is basically random when that will happen. On Wed, Jul 20, 2011 at 10:35 AM, lbendlin l...@bendlin.us wrote: if you want to return to a particular activity when the application is (re)launched you can specify that in the manifest android:launchMode=singleTask android:alwaysRetainTaskState=true are two things worth reading about. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en