首页 > 代码库 > (转)JNI参数传递|Surface
(转)JNI参数传递|Surface
http://blog.csdn.net/stefzeus/article/details/6622011
char* Get_Surface(JNIEnv *env, jclass cls, jobject param, int sdk_version){ // Java层 jfieldID surface = env->GetFieldID(cls, "mSurface", "Landroid/view/Surface;"); jobject surface_cls = env->GetObjectField(param, surface); // Native层 jclass surface_class = env->FindClass("android/view/Surface"); jfieldID surface_native = env->GetFieldID(surface_class, "mSurface", "I"); //"I"指整型 // the JNI also supports other functions such as GetIntField and SetFloatField for accessing instance fields of primitive types. return (char*)(Surface*)env->GetIntField(surface_cls, surface_native);}理解GetIntField(char*)(Surface*)env->GetIntField(surface_cls, surface_native);Once you have obtained the field ID, you can pass the object reference and the field ID to the appropriate instance field access function: jstr = (*env)->GetObjectField(env, obj, fid);
(转)JNI参数传递|Surface
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。