title: Android NDK : How to get a Class Loader With a NativeActivity and native_app_glue?
body: <p>Ok, I have a native application, that is ran off the main thread, which requires C++ to access  some java code. I kept getting error's with FindClass() as my class loader defaults to my system, which doesn't load any of my app's java sources. </p>
  
  <p>A common way around this is to globally reference the classes from my application at JNI_OnLoad, before my code is forked into another thread, so the ClassLoader can be from my application , of which can find all my classes, however since I'm implementing a NativeActivity with native_app_glue, JNI_OnLoad never gets called. </p>
  
  <p>There is a reference to a method "getClassLoader" , here : <a href="https://groups.google.com/forum/#!msg/android-ndk/cKZRjSMUemw/MPXgmjYZ9qkJ" rel="nofollow">https://groups.google.com/forum/#!msg/android-ndk/cKZRjSMUemw/MPXgmjYZ9qkJ</a></p>
  
  <p>Which is suppose to work, however I can't find it, and have no idea of it implementation. </p>
  
  <p>I'm just looking for an example or too, thanks.</p>