You will need to create your custom text editing option as follows.
public class MyEditTextPreference extends EditTextPreference { public MyEditTextPreference(Context context) { super(context); } public MyEditTextPreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public MyEditTextPreference(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE:
Then use it in the XML file as follows:
<com.package.MyEditTextPreference android:dialogTitle="@string/security_setting_button" android:key="set_password_preference" android:summary="@string/set_password_summary" android:title="@string/security_setting_button" android:inputType="number" android:icon="@drawable/lock" />
where com.package should be replaced with the actual package in your project, where you create MyEditTextPreference
source share