@Retention(value=CLASS) @Target(value=TYPE) public @interface SharedPref
Apply @SharedPref on an interface to create a SharedPreference helper
that will contain access methods related to the methods you define in the
interface.
You should then inject your SharedPreference generated class by using
Pref annotation.
Example :
@EBean
public class MyBean {
@Pref
mypackage.MyPref_ myPref;
}
package mypackage;
@SharedPref
public interface MyPref {
// The field name will have default value "John"
@DefaultString("John")
String name();
// The field age will have default value 42
@DefaultInt(42)
int age();
// The field lastUpdated will have default value 0
long lastUpdated();
}
Pref| Modifier and Type | Optional Element and Description |
|---|---|
int |
mode
The operating mode.
|
SharedPref.Scope |
value
The scope of the preferences, this will change the name of the
SharedPreference.
|
public abstract SharedPref.Scope value
Copyright © 2010-2015. All Rights Reserved.