0

I created a menu and put an exit button in it. Now when I click on it, it behaves like a back button and closes the activity.

I want the application to be closed completely by this button. I typed this code at the end of my program:

finish();
System.exit(0);
makes
  • 6,438
  • 3
  • 40
  • 58
Aminika
  • 143
  • 1
  • 7
  • 1
    Note that you [shouldn't need to](http://stackoverflow.com/a/2043302/645270). ([Here's](http://stackoverflow.com/a/2034238/645270) another one. A long one). – keyser Aug 20 '13 at 00:48
  • Your question isn't clear- what exactly do you expect to happen, and what is happening? – Gabe Sechan Aug 20 '13 at 00:48
  • @Kᴇʏsᴇʀ I can think of plenty of reasons to do that- for example any app that has private information that should be session bound or password protected. Android has this point wrong. The default should be to close an app. – Gabe Sechan Aug 20 '13 at 00:49
  • @GabeSechan I'm not sure those are valid reasons. Killing the application would certainly be one way to do things, had it been implemented like that, but I wouldn't call the current state of things a security issue. There are logout buttons. – keyser Aug 20 '13 at 00:52
  • My financial information is secured on my phone. It's more or less the only information that I consider sensitive on my phone, and all those apps have sessions that quickly expire, and when I exit the app I always get prompts that asks me if I want to log out (which I do). And, if I exit gmail, does that prevent anyone else from opening it? I really don't see a problem with this. It seems like you're criticising smart phones in general, not the minimize-system. The fact that you might be logged in to an app you've closed (minimized) is more often than not a "feature" (you know what I mean). – keyser Aug 20 '13 at 01:00
  • sorry guys because of my English my app have alot of branch so for example user from main activity goes t activity A after that B after that C and it is because of my app structure now i want to close it at the last activity . whit this 'finish()' user must go a lung way to close the app – Aminika Aug 20 '13 at 01:01
  • @user2692841 Just plain and simple, drop the idea of an `exit` button in the app. The Android OS (as most other mobile OS's) take care of the app de-allocation on its own. Just design your app without an exist button. – LuckyMe Aug 20 '13 at 01:30
  • @GabeSechan If an app holds secure information, it is well within the developer's capabilities to force re-log-in upon resuming the app. It has nothing to do with closing/opening/minimizing an app. Also, most apps, do not require you to log in every time you launch the app, even if it was closed and not just minimized, it is for convenience. And finally, simply lock your phone with a password, as well as encryption. To summarize, your point is invalid. – LuckyMe Aug 20 '13 at 01:35
  • The average developer isn't very good. I don't trust them to write the app correctly- and I've used a dozen that don't. Launching already logged in is another major security issue I have major disagreements with. A screen lock is not sufficient- people commonly pass around their device after taking the lock off. Android's security model is horrible. Merely exiting the app is a simple yet effective method of fixing things that users understand from decades on the PC. It was a mistake to remove it. In fact most users think its still there- they don't understand the apps aren't closed. – Gabe Sechan Aug 20 '13 at 01:41
  • 1
    @Kᴇʏsᴇʀ I just checked the financial apps from my banks. None of them timed out (after 10 minutes), none of them popped up a logout option on minimization. You think the average quality of apps is far higher than it is. And I don't use gmail (for various reasons), but the fact you can open the app and see your email without putting in a password is sheer idiocy. It is almost NEVER a feature. Its a security hole you can drive a truck through, and unprofessionally stupid. Yes, its endemic in mobile OSes- they're all being equally idiotic. – Gabe Sechan Aug 20 '13 at 01:46
  • @GabeSechan I think you are blowing it out of proportion. And you are missing the point, how can Android force apps to log-out? It is an invalid point. Android has no control over this, and it is not the flaw of the OS, it is the flaw of the developer. It is not like there is ONE log-in method for any app which Android controls, it is customary and up to the developer to implement it. Are you suggesting to have a user-lock-system-level-implementation on every app? PS: `You think the average quality of apps is far higher than it is.` No, I don't. – LuckyMe Aug 20 '13 at 03:34
  • Smartphones really are security risks themselves. A hacker can start videotaping you or listening to you using your microphones. Also, you have it always with yourself, which is excellent to track your route. All in all, knowing what can be done with them and how people are using them I believe that they are responsible to make their OS as secure as possible. Instead of this, they have this "feature" that your data can be stolen easily. An app is not responsible for Android's shortcommings. I hope they will fix this issue. – Lajos Arpad Aug 20 '13 at 03:47
  • 1
    @GabeSechan I agree with you about developers being subpar. And that is one of the problems with mobile phones since they now contain sensitive data. However, this is once again only criticizing smartphones in general. People would obviously be pissed if they had to provide a password every time they viewed their mail in android. The issue is that people need to become more security aware, not that android needs to be more secure. If you want to password protect everything, it is possible, but it's obvious why it's not the default. And if you want to log out after using a bank app, you can. – keyser Aug 20 '13 at 10:46

0 Answers0