NewStringUTF
jstring NewStringUTF(JNIEnv *env, const char *bytes);
Constructs a new
java.lang.String
object from an array of characters in modified UTF-8 encoding.LINKAGE:
Index 167 in the JNIEnv interface function table.PARAMETERS of NewStringUTF
env
: the JNI interface pointer.bytes
: the pointer to a modified UTF-8 string.RETURNS of NewStringUTF
Returns a Java string object, or
NULL
if the string cannot be constructed.THROWS:
OutOfMemoryError
: if the system runs out of memory.
Example of NewStringUTF
extern "C" jstring
Java_com_example_ndk_MainActivity_stringFromJNI( JNIEnv* env,
jobject thiz)
{
return (*env)->NewStringUTF(env, "Hello from JNI !");
}