List of usage examples for android.preference EditTextPreference getKey
public String getKey()
From source file:com.almalence.opencam.Fragment.java
private void initExportName(Preference preference, Object newValue) { EditTextPreference prefix = (EditTextPreference) this .findPreference(getResources().getString(R.string.Preference_SavePathPrefixValue)); String prefixValue = ""; if (prefix != null) { if (preference != null && prefix.getKey().equals(preference.getKey())) { prefixValue = newValue.toString(); } else {//from w w w. j av a 2 s . com prefixValue = prefix.getText(); } if (!prefixValue.equals("")) { prefixValue = prefixValue + "_"; } } EditTextPreference postfix = (EditTextPreference) this .findPreference(getResources().getString(R.string.Preference_SavePathPostfixValue)); String postfixValue = ""; if (postfix != null) { if (preference != null && postfix.getKey().equals(preference.getKey())) { postfixValue = newValue.toString(); } else { postfixValue = postfix.getText(); } if (!postfixValue.equals("")) { postfixValue = "_" + postfixValue; } } ListPreference exportNameList = (ListPreference) this .findPreference(getResources().getString(R.string.Preference_ExportNameValue)); if (exportNameList != null) { String[] names = MainScreen.getAppResources().getStringArray(R.array.exportNameArray); CharSequence[] newNames = new CharSequence[names.length]; int i = 0; for (String name : names) { newNames[i] = prefixValue + name + postfixValue; i++; } exportNameList.setEntries(newNames); exportNameList.setSummary(exportNameList.getEntries()[Integer.parseInt(exportNameList.getValue()) - 1]); } }