0

How do I create and use an internal function in an ndk c++ file?

jstring Java_com_test_ndk_MainActivity_getString(JNIEnv* env, jobject thiz)
{
    jstring strt = getstr();
    return env->NewStringUTF(strt);
}

I want to implement the getstr() function in c++ for just use in ndk side and not java...

Also, how do I get the length of a jstring and implement substring in c++? Does a function exist or must I write my own?

krsteeve
  • 1,794
  • 4
  • 19
  • 29
Araz Jafaripur
  • 927
  • 2
  • 12
  • 32

1 Answers1

0

Just declare and define it:

jstring getstr()
{
   jstring result;

   // do something useful here

   return result;
}
Sergey K.
  • 24,894
  • 13
  • 106
  • 174