Reputation: 1335
I'm starting to learn java's JNI to use with an android device.
As I read somewhere, you must have some "glue" for the C++ part in order to be loaded through JNI.
My question is: Is it posible to have a run() function in C with the glue for JNI having that running the real app and having java only for the entry point? Because I don't know if when invoking that run() function through JNI it may cause problems if that function calls another functions and so on. Thanks for the tip!
EDIT: I want to code in C++ using ndk and trying to avoid coding in java. thus, I wanted to know if a) if I can compile and run in native with ndk or b) if i can use java only to invoke my app, example: calling woth jni something like app->run() and let it do all stuff instead of java. then, java will act only as an entry point.
Upvotes: 0
Views: 1148
Reputation: 933
If you want to develop for Android in C/C++ (no Java) AND you target newer devices (Gingerbread, android-9 app platform onwards) consider using NativeActivity.
See http://developer.android.com/reference/android/app/NativeActivity.html and folder inside NDK package $NDK/docs/NATIVE-ACTIVITY.HTML
together with the sample code $NDK/samples/native-activity
.
Good luck!
Upvotes: 1
Reputation: 20936
I made a step-by-step howto in the following post: How to create dll using android You can read it and put questions if you don't understand something.
Upvotes: 1