Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Send an activity from C# to Java

$
0
0
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("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!

Viewing all articles
Browse latest Browse all 7934

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>