How to call a Java method with a parameter?

My Unity code:

// to get the activity
AndroidJavaClass androidJC = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject jo = androidJC.GetStatic<AndroidJavaObject>("currentActivity");
// Accessing the class to call a static method on it
AndroidJavaClass jc = new AndroidJavaClass("com.lf.clientsampleapp.MainActivity");
// Calling a Call method to which the current activity is passed
jc.CallStatic("Call", jo);

My plugins Java code:

public class MainActivity extends UnityPlayerActivity
{
    public static void Call(Activity activity)
    {
        // Creating an intent with the current activity and the activity we wish to start
        Intent myIntent = new Intent(activity, MainActivity.class);
        activity.startActivity(myIntent);
    }

    public static void Call()
    {
        //Calling this method without a parameter works fine...
    }

This produces a NoSuchMethod exception. But if I call the same method without a parameter from Unity using

jc.CallStatic("Call")

it works fine. So, there is some mapping issue with the parameter.

I tried other variants, like

jc.CallStatic("Call", new object[] { jo });

But still no go… How do I do this?

Is this really impossible…?

That looks correct. Is there any information in the log?

Just a NoSuchMethod exception… I have tried to call other methods with string parameters, and then it works. But the activity object won’t map…

Odd! Could you please file a bug and post the case number here so I can investigate the issue? And so I don’t forget :wink:

I have a similar problem.
I’m making a Unity wrapper for an Android library and I need to take an instance of a class that is defined inside the library, save it, and later, send it back as a parameter for a library method. I have no choice but to save it as an AndroidJavaObject. Could this be a problem when I try to pass it as a parameter? How can I solve this?