title: How to call Java methods from C++ in JNI
body: <p>So I'm writing an Android app which uses a large c++ library.  I have everything working so that the java app can call the c++ delegation methods, but I'm finding myself wishing I could log messages from c++ to the Android log.  This is easy from java, but I'm at a loss as to how to call a java method from c++.  My searches found methods for opening a jvm from c++, which is not at all what I want to do.  Ideally, I'd like to pass a log method pointer to c++, which could then be used whenever I wanted.  Of course, java doesn't support method pointers.  My java method would look something like:</p>
  
  <pre><code>private void log(String s){
     Log.i(Tag, s);     // Android log
  }
  </code></pre>
  
  <p>I just don't know how to allow c++ to access this method.</p>