Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好,请问参数怎么传Object[]数组呢? #675

Open
liuwang168 opened this issue Sep 13, 2024 · 1 comment
Open

你好,请问参数怎么传Object[]数组呢? #675

liuwang168 opened this issue Sep 13, 2024 · 1 comment

Comments

@liuwang168
Copy link

native函数的参数是需要传一个Object[]数组
String sgin = sgmiddletier.callJniMethodObject(emulator, "doCommandNative(I[Ljava/lang/Object;)Ljava/lang/Object;",
Integer.valueOf(10401),new Object[]{map,"21792629",2,"sgAuthCode",true}).toString();
image
image
这个代码里面不支持

@zhaodice
Copy link
Contributor

自己悟

public void n(String s1, Object[] objects) {
        synchronized (emulator) {
            DvmObject<?>[] dvmObjects = new DvmObject[objects.length];
            for(int i = 0; i<objects.length; i++){
                String[] dat = (String[])objects[i];
                if(dat[3].equals("k5")){
                    k5Fun = dat[0]+"->"+dat[1]+dat[2];
                }
                dvmObjects[i] = ArrayObject.newStringArray(vm, dat);
            }
            DvmObject<?> u = newInstance("com/tencent/qimei/uin/U", true);
            u.callJniMethodObject(emulator, "n(Landroid/content/Context;Ljava/lang/String;[Ljava/lang/Object;)V", context, s1, new ArrayObject(dvmObjects));
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants