如何在Android中配置应用程序设置? [英] How to configure application settings in android?

查看:129
本文介绍了如何在Android中配置应用程序设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序必须保持一定的设置选项,一个用户,如货币类型,语言,日历视图(日历或列表)等。

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

在这里,我很困惑我是否通过创建数据库表来配置这一切还是应该保持这种在任何XLM或文本文件。如果有什么比较方便的方法请指导?谢谢。

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.

推荐答案

您可以用安卓的共享preferences 来存储用户preferences。此外,还可以存储全局的变量,如果你创建一个具有静态或实例变量访问的应用程序实例(但如果你的活动被破坏这些值可能会丢失)

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)

href="http://stackoverflow.com/questions/708012/android-how-to-declare-global-variables">这个线程对全球应用程序存储应用程序细节上

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

希望帮助

这篇关于如何在Android中配置应用程序设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆