Created
February 18, 2018 15:37
-
-
Save amadeu01/babeaa8669e610d880ca86177c3eb000 to your computer and use it in GitHub Desktop.
Int Edit Text Preferences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @Author Amadeu Cavalcante Filho | |
* @Date 29/12/2017 | |
* @Email amadeu01@gmail.com | |
*/ | |
public class IntEditTextPreference extends EditTextPreference { | |
public IntEditTextPreference(Context context) { | |
super(context); | |
} | |
public IntEditTextPreference(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public IntEditTextPreference(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
} | |
@Override | |
protected String getPersistedString(String defaultReturnValue) { | |
return String.valueOf(getPersistedInt(-1)); | |
} | |
@Override | |
protected boolean persistString(String value) { | |
return persistInt(Integer.valueOf(value)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment