When I create preference activity I define all preferences in xml file. Every preference has a key defined in this xml. But when I access preference I write:
What about using a helper class to hide the getString() - instantiate the helper once in each activity or service. For example:
class Pref {
final String smsEnable_pref;
final String interval_pref;
final String sendTo_pref;
final String customTemplate_pref;
final String webUrl_pref;
Pref(Resources res) {
smsEnable_pref = res.getString(R.string.smsEnable_pref);
interval_pref = res.getString(R.string.interval_pref);
sendTo_pref = res.getString(R.string.sendTo_pref);
customTemplate_pref = res.getString(R.string.customTemplate_pref);
webUrl_pref = res.getString(R.string.webUrl_pref);
}
}