开发者

Store in sharedPreferences

开发者 https://www.devze.com 2022-12-25 05:35 出处:网络
I have some things in my app that I need to store, in order to have it available the next time I open the appl开发者_StackOverflowication. I wonder if I could save them using the sharedPreferences mec

I have some things in my app that I need to store, in order to have it available the next time I open the appl开发者_StackOverflowication. I wonder if I could save them using the sharedPreferences mechanism even if I don't have any "view" associated with them ! .If this is possible please let me know, if not, what would you suggest instead ?


All you need is a component that can furnish you a handle to the android.os.Context An Activity is such a component. SharedPreference's data is stored in a file - somewhat akin to a properties file (key,value pair).

You can also create your own files and store it in the app's private directory.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号