Question

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);
}
Was it helpful?

Solution

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

Take a look at documentation.

Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top