How to configure application settings in android?

﹥>﹥吖頭↗ 提交于 2019-12-13 00:55:14

问题


In my application I have to keep some setting options for a user, like currency type, language, Calendar view (Either Calendar or List) etc.

Here I am confused whether I have to configure all this by creating database tables or should keep this in any xlm or text file. Please guide if there any more convenient way? thanks.


回答1:


you can use android shared preferences to store a users preferences. Alternatively you can store "global" variables if you create a Application instance which has static or instance variables to access (but these values can be lost if your Activity is destroyed)

The answer on this thread has details on global application to store application wide variables

Hope that helps




回答2:


Android has Shared Preference specifically for this purpose. http://developer.android.com/reference/android/content/SharedPreferences.html




回答3:


The solution would be to use shared preference

You can also look into PreferenceActivity which helps in building a setting page.



来源:https://stackoverflow.com/questions/5699310/how-to-configure-application-settings-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!