1

findViewByIdC++ で呼び出すコードは何ですか? IDC++ の型とは何ですか? 文字列、整数、ポインタ? GetMethodID の署名とは何ですか?

string ID = "sample id";
jFindViewById = (env)->GetMethodID(cls, "findViewById", "ILjava/lang/Id;)Ljava/lang/Object;");
jobject myView = (jobject) (env)->CallObjectMethod(Obj, jFindViewById, ID);
4

1 に答える 1

0

自分で答えを見つけたのですが、あまりわかりませんでしたが、1時間の試行錯誤で答えました。それが他の人に役立つことを願っています。

your jni funcion declaration... (JNIEnv* env, jobject Obj) {
   jmethodID jfindViewById = 0;
   int ID = 2; //get the ID somewhere else, it is just an integer.
   jfindViewById = (env)->GetMethodID(cls, "findViewById", "(I)Landroid/view/View;");
   jobject image_view = (jobject) (env)->CallObjectMethod(Obj, jfindViewById, ID);
}
于 2013-03-19T08:54:30.080 に答える