@@ -0,0 +1,838 @@
+package com.chess.genesis;%0A%0Aimport android.content.Context;%0Aimport android.preference.DialogPreference;%0Aimport android.util.AttributeSet;%0A%0Aclass CallBackPreference extends DialogPreference%0A%7B%0A%09public interface CallBack%0A%09%7B%0A%09%09void runCallBack(final CallBackPreference preference, final boolean result);%0A%09%7D%0A%0A%09private CallBack action;%0A %0A%09public CallBackPreference(final Context context)%0A%09%7B%0A%09%09this(context, null);%0A%09%7D%0A%0A%09public CallBackPreference(final Context context, final AttributeSet attrs)%0A%09%7B%0A%09%09super(context, attrs);%0A%0A%09%09setPersistent(false);%0A%09%09action = null;%0A%09%7D%0A%0A%09public void setCallBack(final CallBack callback)%0A%09%7B%0A%09%09action = callback;%0A%09%7D%0A%0A%09@Override%0A%09protected void onDialogClosed(final boolean positiveResult)%0A%09%7B%0A%09%09super.onDialogClosed(positiveResult);%0A%0A%09%09if (action == null)%0A%09%09%09return;%0A%09%09action.runCallBack(this, positiveResult);%0A%09%7D%0A%7D%0A

add CallBackPreference class for preferences that need to run code