zoukankan      html  css  js  c++  java
  • (转)JNI参数传递|Surface && sign签名对应

    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);

     

    参考:http://blog.csdn.net/jiangwei0910410003/article/details/17465457

  • 相关阅读:
    uva1610 Party Games
    uva1442 Cav
    uva1609 Foul Play
    uva1608 Non-boring sequences
    uva12174 滑动窗口+预处理
    uva 1451 数形结合
    light oj 1336 sigma function
    找常用词(字符串处理)问题
    指定排序问题
    完数问题
  • 原文地址:https://www.cnblogs.com/wainiwann/p/5961825.html
Copyright © 2011-2022 走看看