I’m writing custom EditTextPreference.
Using this code inside my CustomEditTextPreference:
@Override
protected void onDialogClosed(boolean shouldSave) {
if (shouldSave) {
String sValue = getText();
value = Float.parseFloat(sValue);
peristValue();
}
}
sValue is null. How do I acquire the value from edit then?
You should probably use
Since
getText()by itself gets the current SharedPreference value, which may or may not exist.