Android - Setting and Fetching a StringSet from SharedPreferences?

后端 未结 2 978
执笔经年
执笔经年 2021-01-17 20:03

Good day, I am building an Android Application. I want to store a set of strings in the Preferences to order to track who used the application based on their log in informat

2条回答
  •  再見小時候
    2021-01-17 20:16

    You could write your results to a JSON String and store them in Shared Preferences like this: https://stackoverflow.com/a/5968562/617044

    But if you choose to go down the route you're currently on then you're going to have to store a parcelable.

    As noted in another answer; you can use putStringSet(), getStringSet() if you're building for API 11+.

提交回复
热议问题