質問

I have followed this tutorial for using compound dialogpreference

All stuff is working well only the issue is preferences are not saving for the app. May be the system is not saving the preferences by default so is there any way to save them.

I have implementd callChangeListener() method for saving preferences:

@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE:
        mText = mEditText.getText().toString();
        Log.e("**CompoundEditTextPref line 63**",mText);
        callChangeListener(mText);
        break;
    }
    super.onClick(dialog, which);
}
役に立ちましたか?

解決

You need to use the method persistString(String value). To retrieve value use getPersistedString (String defaultReturnValue).

Take a look at documentation.

Hope it helps.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top