I work on Android project with AndroidAnnotations and I want to use it for SharedPreferences. I want to use @DefaultStringSet
. When I want to define default value with a String[]
I got error:
Attribute value must be constant
The same happens for HashSet
. I also tried to define public static variable of type String[]
, but nothing changes.
According to this there is no way to set constant for anything but primitives and Strings.
I looked for examples, but found nothing. So what is the way to initialize this preference, is this doable?
I work on AndroidAnnotations 4.1.0
An array initializer is also a constant expression, that is how it can be used in annotations:
@DefaultStringSet({"one", "two", "three"})