I have a method in my java library that gets a Map as an input.
here is my java method
public void myMethod(Map<String, String> map){
//do some thing with this map
}
And my C# code in Unity
AndroidJavaObject javaMap= new AndroidJavaObject("java.util.HashMap");
javaMap.Call("put", "key1", "value1");
AndroidJavaClass javaClass = new AndroidJavaClass("com.alirezaahmadi.android.sdk.core.BaseAPI");
javaClass.CallStatic("myMethod", javaMap);
I can try some code like this but Map is a generic class and this code doesn't work
when i run this i get this error
AndroidJavaException: java.lang.NoSuchMethodError: no non-static method with name='put' signature='(Ljava/lang/String;Ljava/lang/String;)V' in class Ljava.lang.Object;
java.lang.NoSuchMethodError: no non-static method with name='put' signature='(Ljava/lang/String;Ljava/lang/String;)V' in class Ljava.lang.Object;
How can i fix this and path a java hashmap to this method. BTW I can not change the java code.
myMethodmethod? Maybe tell us which line of from the C# is causing the error. With what you have now there is no way one can figure out your problem.