How can a PreferenceActivity use a custom preference file

前端 未结 3 1382
谎友^
谎友^ 2021-02-05 06:43

My first attempt at preferences was without knowledge of PreferenceActivity. So now I have an app that stores all user preferences in a specific preference file.

3条回答
  •  野的像风
    2021-02-05 07:06

    Maaalte is correct, what you want to do is onCreate test for the existence of your custom file and if it's there, rename it to standard shared preferences filename.

    Another option is to read your old prefs one-by-one and use the shared preferences API to add them as you read them and then delete your old prefs when you are done.

提交回复
热议问题