Please move this all the way down right before where you use it. We only have a limited amount of JNI references available and therefore we need to create them as late as possible and destroy them as early as possible.

PS : I assume you copied this from the StartActivity() method so maybe you can change it there as well if you got time.