- Home /
Send an activity from C# to Java
Hi Everyone!
I have a problem sending a variable of type Activity from C# to Java.
The following source code is what I did in C#:
public static string TestJava()
{
string somestring = "";
playerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
activity = playerClass.GetStatic<AndroidJavaObject>("currentActivity");
pluginClass = new AndroidJavaClass("com.Vector3GameStudio.GoogleMobileAds.GoogleMobileAdsActivity");
try
{
pluginClass.CallStatic("Test", activity );
}
catch
{
somestring += "ERROR invoking Test";
}
return somestring;
}
And the following source code is the Java method who it will recieve the Activity.
public static void Test(Activity currentActivity)
{
// Doesn't get here at all
}
If I change the parameter Activity in the Java method by String, int and so on, the code works well but if I change it by an Activity, the java invocation doesn't work.
Could someone help me with that?
Thank you in advance!
Comment