haxenme/NME — pull request #86 by DanielUranga (2013-06-25 22:18:17+00:00)
Title: Android target improvements.

Improved stability (specially when pausing and resuming the activity several times).
Improved FindClass method in AndroidCommon.cpp, so methods that uses JNI called from non-main threads can find Java classes.
Added a method for detaching current JVM thread (it needs to be called every time a threads exits).

Example code that crashes in current NME (showing the issue with threads):
```haxe
import nme.Assets;
import nme.Lib;
import nme.display.Sprite;
import nme.events.Event;
import cpp.vm.Thread;
import nme.JNI;

class NmeTest extends Sprite {

public function new()
{
super();
addEventListener(Event.ADDED_TO_STAGE, init);
}

static var _launchBrowser_func:Dynamic;
public static function launchBrowser(arg0:String) : Void
{
if (_launchBrowser_func==null)
{
_launchBrowser_func=nme.JNI.createStaticMethod("org/haxe/nme/GameActivity","launchBrowser","(Ljava/lang/String;)V");
}
_launchBrowser_func(arg0);
}

function init(_)
{
Thread.create(function()
{
launchBrowser("http://www.google.com");
JNI.detachCurrentThread(); // This needs to be commented in order to compile in non-patched NME
trace("Post detach thread");
});
}

public static function main()
{
Lib.current.addChild(new NmeTest());
}

}
```