system.exit

How does Java's System.exit() work with try/catch/finally blocks?

I'm aware of headaches that involve returning in try/catch/finally blocks - cases where the return in the finally is always the return for the method, even if a return in a try or catch block should be the one executed. However, does the same apply to System.exit()? For example, if I have a try block: try { //Code System.exit(0...

Setting default System.exit codes in Java?

I have a C# app that runs a jar file and uses the System.exit code as a return value. A console window is displayed as a part of this jar, and if the user closes it (thereby terminating the jar) it returns an exit code of 143. The problem is that 143 (or any positive integer) could be a valid exit code if the jar completes successfully. ...

Android: Show toast after finishing application / activity

Hi, I want to show a simple toast, when exiting an application. The problem is, that the toast is not shown. I assume it is because the acitivity is finished or because of System.exit(0), but I don't know how to solve it. Does anyone have a tip? Thanks!! In my activity I have the following code: Toast.makeText(this,"Exit application."...

Cant stop a while loop with a button

Hello. Im trying to write a program which moves the mouse every 3 minutes (to stop a screen saver coming on) but I want to be able to stop and start it at will. As you can see below I have create the buttons and method but when you click run it steps into the while loop and because its in effect an infinite loop it won't look and see if...