Android Question mix: constants, enum, reflection

LucaMs

Expert
Licensed User
Constants and enum can be very useful. I was thinking about how to emulate them in B4A.

Before I do any attempt, I would ask:

is there a way using reflection?

I would be grateful to anyone who will list on wich kind/type of objects/classes the reflection is most useful, on which it can not be used and small examples.

Obviously, I like to know how you solved the problem enum.

Many thanks.


P.S. for Enums, i'm trying:

B4X:
'Class module
Sub Class_Globals
    Private mBlue, mYellow, mGreen As Int
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize()
    mBlue = 0
    mYellow = 1
    mGreen = 2
End Sub

Public Sub getBlue As Int
    Return mBlue
End Sub

Public Sub getYellow As Int
    Return mYellow
End Sub

Public Sub getGreen As Int
    Return mGreen
End Sub
 
Last edited:
Top