Skip to content

Using @StringDef in kotlin

Devrath edited this page Oct 24, 2024 · 5 revisions

About @StringDef

  • @StringDef is an annotation in Android that is part of the Android annotation processing framework.
  • It is used to enforce type safety when dealing with string constants.
  • Instead of using enum which is costly in terms of memory and performance, especially in Android @StringDef ensures only specific strings could be passed as values or used as parameters.

Why to use @StringDef

Clone this wiki locally