Reputation: 2289
I have a pure NDK application, entirely C++
.
I now need to add access to a WebView
; Google search and stack-overflow have informed me that I have to do this in Java
.
How do I go about including Java
class (derived from WebView
) into my pure Android NDK application and how do I invoke it?
Note: I am not using Eclipse or any other IDE, just .mk
file etc.
Upvotes: 1
Views: 1544
Reputation: 690
You would have to use JNI and make an upcall from your C++-code to Java. Calling a Java language method from within native code involves the following three steps:
There's a good explaination on how to do this here: Sun JNI Reference
You need a Java class that can receive this method call, and that can start up an Activity containing a webview. So, you can include and invoke Java from C++, but naturally you still need to implement the Java-class in Java, there's no getting away from that.
Upvotes: 2