xbmc/xbmc — pull request #2383 by theuni (2013-03-06 20:58:44+00:00)
Title: Android JNI Manager

This is the continuation of https://github.com/xbmc/xbmc/pull/2276, but now it's functional. It's overkill for now, but solves a few future problems:

1. Solution for http://blog.tewdew.com/post/6852907694/using-jni-from-a-native-activity . We now cache the java classes at startup (whether they use native functions or not), so that they are available for the life of the app. This is one of the suggested solutions to the problem as outlined here: http://developer.android.com/training/articles/perf-jni.html#faq_FindClass

2. Organized java/native class bridge. Each Java class will have a corresponding native class, complete with the functionality it needs to call into Java.

3. Central manager. All custom Java access is handled through a single class. It was sure to get unwieldy otherwise.

4. Automation. All resolving/loading is handled automatically at startup. Classes can assume a working environment.

This was tested with a few hackish POC java classes that have not been added here.