Back to project page WarDroid.
The source code is released under:
MIT License
If you think the Android project WarDroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.deathsnacks.wardroid.utils.preferences; /*from w ww. j a va 2 s . c o m*/ import android.content.Context; import android.preference.EditTextPreference; import android.util.AttributeSet; /** * Created by Admin on 05/02/14. */ 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) { try { return persistInt(Integer.valueOf(value)); } catch (NumberFormatException e) { return persistInt(0); } } }