Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Kotlin enum from Java

Tags:

java

kotlin

I have an enum defined in a Fragment companion object:

enum class Channel {
    TAG_FRIENDS, CHALLENGE_INVITE, COMMITMENT_INVITE
}

Normaly I'll access it from another Kotlin class like that:

MyFragment.Companion.Channel.TAG_FRIENDS

How would I access it from a Java class? The Channel enum doesn't seem to be accessable...

like image 226
Ambran Avatar asked Jan 19 '26 03:01

Ambran


1 Answers

Just in case anyone still need this:

 Channel.TAG_FRIENDS.getValue()
like image 163
Wale Avatar answered Jan 20 '26 15:01

Wale