Store in sharedPreferences
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.
精彩评论