rhomobile/rhodes — Issue #54: System.exit is not working on Android when accessed through a link
Author: corthmann
Created: 2011-11-11 17:13:02+00:00
State: open

The System API command "System.exit" has stopped working on Android when accessed through a link. I know it last worked in Rhodes 3.1.0, but since Rhodes 3.2.0 it throws the following exception (the stacktrace is from a Rhodes 3.2.2 application):

```
RhodesService | java.lang.RuntimeException:
Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.(Handler.java:121)
at com.rhomobile.rhodes.RhodesApplication.stop(RhodesApplication.java:109)
at com.rhomobile.rhodes.RhodesService.exit(RhodesService.java:622)
at dalvik.system.NativeStart.run(Native Method)
```

I have noticed that there only is a problem when the System.exit command is accessed through a link such as the cases below, whereas it works perfectly through render :back. It should also be noted that the menu action :close still works perfectly as well.

```
...

...

def index
action = @params['act']
if action == 'exit'
exit
else
# Do something else
render :back => :exit
end
end

def exit
System.exit
end
```