I want to initialize the Preferences default values for my mobile application. Is there a standard way to do it or should I do it in my own way?
I used the init() method to do so, but I would like to know if there is any built-in way to do it.
I want to initialize the Preferences default values for my mobile application. Is there a standard way to do it or should I do it in my own way?
I used the init() method to do so, but I would like to know if there is any built-in way to do it.
I don't get the problem?
Codename One has two ways of defining the defaults for get:
String value = Preferences.get("MyKey", "DefaultValue");
or:
String otherValue = Preferences.getAndSet("MyKey", "DefaultValue");
The latter is used the default value is set into the field so you don't need to keep using default values in the code.