Re: [android-developers] Re: How to close entire app?
Hello, I had same issue with closing entire application and found following solution, which works fine for me: http://softteco.blogspot.com/2011/07/how-to-close-activity-and-all-children.html Please let me know if you have any questions. Best regards, Yahor On Sun, Aug 14, 2011 at 11:10 AM, Andry Jiang andryde...@gmail.com wrote: Perhaps you could try creating your own BroadcastReceiver on every Activity that will exit its Activity upon receiving broadcasted message sent from the last page when user choose to exit the app. I haven't tried it myself but I hope it gives you a clue to solve your problem. Otherwise you should call finish on every Activity upon starting another Activity and handle starting previous Activity when user press a Back key On Fri, Aug 12, 2011 at 10:17 PM, ndiiie90 rnd...@gmail.com wrote: Hi again Mark, I must close the entire app, because my app is a commerce application, that has its own flow until the payment, and user can't go back to previous screen, so whenever user has reached the last page, there are options to exit the app or go back to menu again..have any idea? Thanks, Rendy On Aug 11, 7:49 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Aug 10, 2011 at 10:55 PM, ndiiie 90 rnd...@gmail.com wrote: how to close entire app? You don't, any more than you close entire Web app. Android will terminate your process eventually, just leave it alone. -- Mark Murphy (a Commons Guy)http://commonsware.com| http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 Available! -- 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 -- 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: How to close entire app?
Perhaps you could try creating your own BroadcastReceiver on every Activity that will exit its Activity upon receiving broadcasted message sent from the last page when user choose to exit the app. I haven't tried it myself but I hope it gives you a clue to solve your problem. Otherwise you should call finish on every Activity upon starting another Activity and handle starting previous Activity when user press a Back key On Fri, Aug 12, 2011 at 10:17 PM, ndiiie90 rnd...@gmail.com wrote: Hi again Mark, I must close the entire app, because my app is a commerce application, that has its own flow until the payment, and user can't go back to previous screen, so whenever user has reached the last page, there are options to exit the app or go back to menu again..have any idea? Thanks, Rendy On Aug 11, 7:49 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Aug 10, 2011 at 10:55 PM, ndiiie 90 rnd...@gmail.com wrote: how to close entire app? You don't, any more than you close entire Web app. Android will terminate your process eventually, just leave it alone. -- Mark Murphy (a Commons Guy)http://commonsware.com| http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 Available! -- 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
[android-developers] Re: How to close entire app?
Hey what are you guys talking about? I don't understand.. :(:(:( On Aug 13, 12:38 am, Robert Thau rst...@gmail.com wrote: On Fri, Aug 12, 2011 at 11:17 AM, ndiiie90 rnd...@gmail.com wrote: Hi again Mark, I must close the entire app, because my app is a commerce application, that has its own flow until the payment, and user can't go back to previous screen, so whenever user has reached the last page, there are options to exit the app or go back to menu again..have any idea? With the caveat that I haven't actually tried either of these techniques: If you don't want Back to *ever* work, then you could try having each Activity call finish() after starting the next. Otherwise, you could think about having some sort of transaction ID that's passed between them, and have them check in onResume whether that transaction is over, calling finish() if so. Either way, though, disabling the Back button is something to be done with caution --- users are used to having it work a certain way, and violating those assumptions is likely to give them a seriously bad experience. rst -- 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
[android-developers] Re: How to close entire app?
I've used the finish() option - with multiple activities, it's a great way to go. As such: Intent newActivity = new Intent(); // set stuff for Intent startActivity(newActivity); finish(); When you hit back, the activity is finished, so it goes to whatever previous activity was not finished. This is like a web browser having an expired page (but Android handles it much better - you don't have multiple browsers, multiple OS's, stateless connections, etc. so you can do a lot more; as Mark points out, the web model is a good model for transaction processing). Also, make sure the activity does not display on the recents list, or you might find yourself with users that start in the middle of your transaction process... OK, so since we helped, could you stop the REBOOT code on the web browsers??? Or just give us names of people that do stuff like that. Either way, I'll help pay shipping on that airmail Mark is talking about! @ndiiie90 - vague question. Do you have a specific problem related to the topic? -Jim On Aug 12, 12:38 pm, Robert Thau rst...@gmail.com wrote: On Fri, Aug 12, 2011 at 11:17 AM, ndiiie90 rnd...@gmail.com wrote: Hi again Mark, I must close the entire app, because my app is a commerce application, that has its own flow until the payment, and user can't go back to previous screen, so whenever user has reached the last page, there are options to exit the app or go back to menu again..have any idea? With the caveat that I haven't actually tried either of these techniques: If you don't want Back to *ever* work, then you could try having each Activity call finish() after starting the next. Otherwise, you could think about having some sort of transaction ID that's passed between them, and have them check in onResume whether that transaction is over, calling finish() if so. Either way, though, disabling the Back button is something to be done with caution --- users are used to having it work a certain way, and violating those assumptions is likely to give them a seriously bad experience. rst -- 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
[android-developers] Re: How to close entire app?
And a warhead, I presume? On Aug 12, 10:38 am, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 12, 2011 at 1:18 PM, Kevin TeslaCoil Software ke...@teslacoilsw.com wrote: So, if this were a Web app, you would attempt to reboot the user's PC to prevent them from pressing the BACK button in their Web browser? That is exactly how I handle my web apps! So *you're* the $##%)#$(@ guy who keeps %$#)%$(# rebooting my machine! :: ominously presses large red button :: So can you send me reboot code for the onBackPressed()? It is urgent. Um, sure! That code is, er, on its way right now! It's being delivered air mail, so, um, watch the skies and keep an eye out for it! It'll be packaged in a long silver tube with tail fins and a contrail. -- 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
[android-developers] Re: How to close entire app?
Go back to whomever stated this awful requirement and explain: 1) why it is a bad idea in the first place and 2) why it is an even much worse idea in the Android environment, where the user's expectations really are radically different from the desktop PC user's expectations. In particular, users will hate you with a passion if you play around with the meaning of 'Back'. They will also hate you if you keep causing their system to crash because you were too stubborn to follow good design guidelines and Google recommended practices. Exit the app indeed! Mark M. is, as usual, quite right. You should leave 'exit' up to the system. If you are concerned about protecting private data, you should do that by wiping it yourself, so that what is left in memory is no longer valid. BTW: whenever I have encountered a commerce app with a UI like what you describe, I write a complaint for the customer service department and never patronize them again. On Aug 12, 8:17 am, ndiiie90 rnd...@gmail.com wrote: Hi again Mark, I must close the entire app, because my app is a commerce application, that has its own flow until the payment, and user can't go back to previous screen, so whenever user has reached the last page, there are options to exit the app or go back to menu again..have any idea? Thanks, Rendy On Aug 11, 7:49 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Aug 10, 2011 at 10:55 PM, ndiiie 90 rnd...@gmail.com wrote: how to close entire app? You don't, any more than you close entire Web app. Android will terminate your process eventually, just leave it alone. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 Available! -- 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
[android-developers] Re: How to close entire app?
Hi again Mark, I must close the entire app, because my app is a commerce application, that has its own flow until the payment, and user can't go back to previous screen, so whenever user has reached the last page, there are options to exit the app or go back to menu again..have any idea? Thanks, Rendy On Aug 11, 7:49 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Aug 10, 2011 at 10:55 PM, ndiiie 90 rnd...@gmail.com wrote: how to close entire app? You don't, any more than you close entire Web app. Android will terminate your process eventually, just leave it alone. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 Available! -- 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: How to close entire app?
On Fri, Aug 12, 2011 at 11:17 AM, ndiiie90 rnd...@gmail.com wrote: I must close the entire app No, you don't. because my app is a commerce application, that has its own flow until the payment, and user can't go back to previous screen, so whenever user has reached the last page, there are options to exit the app or go back to menu again..have any idea? So, if this were a Web app, you would attempt to reboot the user's PC to prevent them from pressing the BACK button in their Web browser? If not, what would you do in the Web app? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0 Available! -- 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
[android-developers] Re: How to close entire app?
So, if this were a Web app, you would attempt to reboot the user's PC to prevent them from pressing the BACK button in their Web browser? That is exactly how I handle my web apps! So can you send me reboot code for the onBackPressed()? It is urgent. :) -- 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: How to close entire app?
On Fri, Aug 12, 2011 at 12:18 PM, Kevin TeslaCoil Software ke...@teslacoilsw.com wrote: So, if this were a Web app, you would attempt to reboot the user's PC to prevent them from pressing the BACK button in their Web browser? That is exactly how I handle my web apps! So can you send me reboot code for the onBackPressed()? It is urgent. You forgot to say plz. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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: How to close entire app?
On Fri, Aug 12, 2011 at 1:18 PM, Kevin TeslaCoil Software ke...@teslacoilsw.com wrote: So, if this were a Web app, you would attempt to reboot the user's PC to prevent them from pressing the BACK button in their Web browser? That is exactly how I handle my web apps! So *you're* the $##%)#$(@ guy who keeps %$#)%$(# rebooting my machine! :: ominously presses large red button :: So can you send me reboot code for the onBackPressed()? It is urgent. Um, sure! That code is, er, on its way right now! It's being delivered air mail, so, um, watch the skies and keep an eye out for it! It'll be packaged in a long silver tube with tail fins and a contrail. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://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
Re: [android-developers] Re: How to close entire app?
On Fri, Aug 12, 2011 at 11:17 AM, ndiiie90 rnd...@gmail.com wrote: Hi again Mark, I must close the entire app, because my app is a commerce application, that has its own flow until the payment, and user can't go back to previous screen, so whenever user has reached the last page, there are options to exit the app or go back to menu again..have any idea? With the caveat that I haven't actually tried either of these techniques: If you don't want Back to *ever* work, then you could try having each Activity call finish() after starting the next. Otherwise, you could think about having some sort of transaction ID that's passed between them, and have them check in onResume whether that transaction is over, calling finish() if so. Either way, though, disabling the Back button is something to be done with caution --- users are used to having it work a certain way, and violating those assumptions is likely to give them a seriously bad experience. rst -- 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
[android-developers] Re: How to close entire app?
Set a flag in the current activity when it exits (for example, in onPause or onStop) when you want to exit the app. Then, in your other activities, check for the flag in onResume. Be sure to reset the flag in onCreate in launch activities - otherwise, you're permanently exiting. Also, the activities might still reside in memory, as Mark points out. Configuration changes are a pain (for example, the app is exiting but the user rotates the phone... the activity is destroyed and re-created, wiping the flag out... or worse, not resetting it properly). This is hazardous, so be cautious; lots of user scenarios, even for simple apps, with unintended consequences... Mark's suggestion is better for almost all apps - wait for the user to hit back. -Jim On Aug 11, 7:49 am, Mark Murphy mmur...@commonsware.com wrote: On Wed, Aug 10, 2011 at 10:55 PM, ndiiie 90 rnd...@gmail.com wrote: how to close entire app? You don't, any more than you close entire Web app. Android will terminate your process eventually, just leave it alone. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 Available! -- 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