织梦CMS - 轻松建站从此开始!

罗索

当前位置: 主页>嵌入式开发>Android>

JNI参数传递|Surface

落鹤生 发布于 2012-04-25 09:13 点击:次 
Once you have obtained the field ID, you can pass the object reference and the field ID to the appropriate instance field access function:
TAG:

  1. char* Get_Surface(JNIEnv *env, jclass cls, jobject param, int sdk_version) 
  2. // Java层 
  3. jfieldID surface = env->GetFieldID(cls, "mSurface""Landroid/view/Surface;"); 
  4. jobject surface_cls = env->GetObjectField(param, surface); 
  5.  
  6. // Native层 
  7. jclass surface_class = env->FindClass("android/view/Surface"); 
  8. jfieldID surface_native = env->GetFieldID(surface_class, "mSurface""I"); //"I"指整型 
  9.  
  10. // the JNI also supports other functions such as GetIntField and
  11. // SetFloatField for accessing instance fields of primitive types. 
  12. return (char*)(Surface*)env->GetIntField(surface_cls, surface_native); 
  13.  

理解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:

(stefzeus)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201204/15953.html]
本文出处:CSDN博客 作者:stefzeus 原文
顶一下
(2)
33.3%
踩一下
(4)
66.7%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容