JNI ArrayList<Hashtable> to Unity C#?

Hi all,

can anyone help me with using an ArrayList<Hashtable<String, String>> in C#

I can get bools, and strings from an android native lib without issue but this one is throwing me,

public ArrayList<Hashtable<String, String>> getProducts()
{
          return pluginClass.CallStatic<ArrayList<Hashtable<String, String>>>("getProductList");
}

Many Thanks

You can return it as an AndroidJavaObject. What sort of functionality do you need to call on it once it is returned in C# ?

Hi mate,

I only need to read the contents of it.

I’ve now got,

public List<Dictionary<String, String>> getProducts()
{
    return pluginClass.CallStatic<AndroidJavaObject>("getProductList");
}

which throws the error,

Cannot implicitly convert typeUnityEngine.AndroidJavaObject’ toSystem.Collections.Generic.List<System.Collections.Generic.Dictionary<string,st‌ring>>

Thanks

You cannot convert one type to another - one is a Java type, returned as a generic java “object”.
C# knows nothing about that object, it only has some “pointer”, pointing to a Java object that lives on the JVM and is part of the (Javao) android code.