Java Question How to handle Enum in Listener?

tchart

Well-Known Member
Licensed User
Longtime User
Hi

I'm writing a wrapper for a library. I have several listeners working as expected which pass through floats etc

Another listener passes back an Object and a Enum.

What is the best way to handle an Enum in B4A?

Should I cast the Enum to a string in the wrapper or is there a smarter way to handle the Enum?

Ideally I would like to avoid duplicating the Enum with custom types in B4A (as per here) which is why Im thinking of returning a string.

Any better ways to do this?

Thanks
 

tchart

Well-Known Member
Licensed User
Longtime User
Thanks Erel.

I did notice that the Strings are cast to Enums automatically when calling a function.

The problem I was having was with the "signature" of my listener which was sending returning an Enum. I had to change the return type to be a String.
 
Top