Docs Menu

Enumerations - Android SDK

On this page

  • Usage

Enumerations, also known as enums, are not supported natively in the Android SDK. However, you can use Java and Kotlin enums in your Realm objects if you follow these steps.

To use an enum in a Realm object class, define a field with a type matching the underlying data type of your enum. Create getters and setters for the field that convert the field value between the underlying value and the enum type. You can use the Java's built-in Enum.valueOf() method to convert from the underlying type to the enum type.

On this page

Give Feedback
MongoDB logo
© 2021 MongoDB, Inc.


  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.