I've been writing a Xamaring Bindings Library for a third party Android JAR and become stumped at how to convert an int field in a class to an enum.
I've created a C# enum for the int fields using EnumFields.xml and have also got this successfully return out of methods using EnumMethods.xml but in one place a class is instead returned which exposes an int field which should be my enum.
I've tried:
<method jni-name="error" parameter="return" clr-enum-type=....
Within EnumMethods but couldnt get it to work, i then tried
<attr path=".......[@name='Result']/field[@name='error']"
name="managedType">
Within Metadata.xml but also couldn't get it to map. I can change its property name but not its return type.
Within the JavaDoc it says the following:
public final int error
And in my generated C# I get:
// Metadata.xml XPath field reference: path="/api/package[@name='cn.com.aratek.util']/class[@name='Result']/field[@name='error']"
Have I missed something obvious?
A year later I ended up stumbling across my own post after hitting the same issue again.
For reference my error was trying to use managedType
as the name. You simply use type
.
e.g within metadata.xml
<attr path=".......[@name='Result']/field[@name='error']" name="type">NewEnumName</attr>
References I used to help figure this out: