@Retention(value=CLASS) @Target(value=FIELD) public @interface PreferenceByKey
Use it on a Preference or
Preference subtype fields in a
EActivity or
EFragment annotated
class, which is a subclass of PreferenceActivity or PreferenceFragment, respectively.
The annotation value should be an array of R.string.* fields.
Your code related to injected preferences should go in an
AfterPreferences
annotated method.
Example :
@EActivity
public class SettingsActivity extends PreferenceActivity {
@PreferenceByKey(R.string.myPref1)
Preference myPreference1;
@PreferenceByKey(R.string.checkBoxPref)
CheckBoxPreference checkBoxPref;
@AfterPreferences
void initPrefs() {
checkBoxPref.setChecked(false);
}
}
AfterPreferencespublic abstract String resName
Copyright © 2010-2015. All Rights Reserved.