Here is an example of two parameters, multiple parameters are the same
Enumeration class
enum class ServerEnum(val key: String, val value: String) {TEST (" http://10.10 ", "http://img.com/"), VIDEO (" http://10.11 ", "http://video.com/"); }Copy the code
call
E ("zxy", serverEn.valueof ("TEST").value)// Obtain enumeration value log.e ("zxy", serverEn.valueof ("TEST").value)// Obtain enumeration value log.e ("zxy", ServerEnum. TEST. The ordinal. ToString ()) / / get the index by enumeration the e (" zxy, "ServerEnum. TEST. Key) / / get the key by enumeration the e (" zxy", Serveren.test. value)// Obtain the value by enumeration // Obtain the value by enumeration parameter name Key or value Serveren.values ().map {enum-> if(enum.key==ServerEnum.TEST.key){ Log.e("zxy",ServerEnum.TEST.value) } }Copy the code