How do I call a Java method which does't have any parameter using AndroidJNI?

If I want to call a Java method with no parameters using AndroidJNI, what do I do?
Is the below code correct which just passes null instead of a jvalue object?

AndroidJNI.CallIntMethod(javaObj, javaMethodID, null);

Yes, it should work. Note, that the last argument is an array of jvalues. Passing empty array there will work too.
You may also find this helpful:

2 Likes

@Aurimas-Cernius By “empty array”, you mean a zero-length array, which is new jvalue[0], right?

Yes. This is what Unity code for AndroidJavaObject/Class does internally. But I think passing null should work too.

1 Like

@Aurimas-Cernius Thankeeeeeeeeeeew!