How to access values from c++ to java in android -
i importing c++ based project(or library) in android app.i used ndk purpose.i succeed embedding c++ in java.now need pass values , c++ , java.can 1 suggest how access information(text,images,or videos) c++ processed project android project.expecting simple tutorials..
you can access text(strings), arrays, integer data android c++ using jni.
eg. android function:
public native setstring(string arg);
the above string arg can accessed using jni in c/c++ code shown below:
c function:
char *str = (*env)->getstringutfchars(env, arg, 0);
c++ function dont pass env parameter.
similarly other elements android can accessed in c/c++ using jobject class of jni.
however access android variables c/c++ either need return control c/c++ function android or can call android function c/c++ function can set values of android functions. example can find in below link:
accessing java variable native code via jni giving junk value
good example of using picture data can obtained android-ndk sample programs(plasma app in sample programs).
Comments
Post a Comment