Wojciech Wojciech - 4 months ago 11
Android Question

DefaultStringSet with

I work on Android project with AndroidAnnotations and I want to use it for SharedPreferences. I want to use

. When I want to define default value with a
I got error:

Attribute value must be constant

The same happens for
. I also tried to define public static variable of type
, 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"})