Allow me to introduce JNIpp library which uses the power of C++ to give you better Java native interface.
It features predefined wrappers for basic classes (Object, String, Class, etc.), wrappers for arrays (both primitive and object), exception translation between Java and C++, and finally, macros to simplify creation of your own wrapper classes.
Github project: https://github.com/DmitrySkiba/itoa-jnipp
Help and examples: http://dmitryskiba.github.com/itoa-jnipp/
As a demonstration I used JNIpp to get IMEI from native code: https://gist.github.com/1017293
Also there is a HelloJNIpp sample that shows how one can create wrappers for Activity, View and Canvas to implement completely native application with custom draw view.
Spoiler:
- Code: Select all
void MainActivity::OnCreate(const jni::LObject& bundle) {
Activity::OnCreate(bundle);
SetContentView(R::GetLayout("main"));
FindViewById(R::GetID("changeColor"))->
SetOnClickListener(*this,&MainActivity::ChangeColor);
}

