NDK : how to return String, Int From Native Code
Step one : Return String from your code
jstring Java_com_manoj_hellojni_HelloJni_stringFromJNI(JNIEnv* env,
jobject thiz) {
return (*env)->NewStringUTF(env, "stringFromJNI !");
}
Step Two : Return integer from your code
Java_com_manoj_hellojni_HelloJni_getTwoNumMul(JNIEnv *env, jobject obj,
jint first, jint second) {
jint mul = first*second;
return mul;
}
jstring Java_com_manoj_hellojni_HelloJni_stringFromJNI(JNIEnv* env,
jobject thiz) {
return (*env)->NewStringUTF(env, "stringFromJNI !");
}
Step Two : Return integer from your code
Java_com_manoj_hellojni_HelloJni_getTwoNumMul(JNIEnv *env, jobject obj,
jint first, jint second) {
jint mul = first*second;
return mul;
}
Comments
Post a Comment