Reputation: 8584
I could call a very simple JNI method below from Java on Android somehow. However I have no idea what should I do next.
JNIEXPORT jstring JNICALL Java_com_test_ndktest_MyActivity_HelloJNI
(JNIEnv *env, jobject obj)
{
(*env)->NewStringUTF(env, "Hello from JNI");
}
What I want to do are two things...
String str1 = new String("Hello World!"); String new_str1 = str1.substring(2, 5); System.out.println(new_str1); // llo
I may be able to get caller's package name. I want to avoid calling by unexpecting callers.
I am very grateful if you can share any hints or advices.
Thanks
Upvotes: 0
Views: 830
Reputation: 4981
Why don't you do that in Java? As for me the better way is to do this things in java. Sorry if i din't understand something.
As you know you can use C/C++. Did you see this: Elegant way to copy substring from char* to std::string or http://www.cplusplus.com/reference/string/string/string/?
Upvotes: 2