what is the Best way to use shared preferences between activities

后端 未结 4 824
悲哀的现实
悲哀的现实 2020-12-08 16:13

I have a user preference in my app, which gets used by different activities. I would like to know the best way to utilize those preferences between different activities in m

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-08 16:41

    You can of course use shared preferences in your applications.

    If you have more than a simple type than string or int, you can use a singleton or extends the application class which will be accessible by all activities of your application. => No disk access here. Simply kept in memory.

提交回复
热议问题