简体   繁体   English

首选项默认值未激活

[英]Preference default value not activating

I have a weird problem in my program. 我的程序中有一个奇怪的问题。 I need to click the preference menu before the defaults value are activated. 在激活默认值之前,我需要单击首选项菜单。 This is not good... How can you make the preference default value activated when the program starts and not when you click on the settings menu? 这不好。。。如何在程序启动时而不是在单击设置菜单时激活首选项默认值? Is there to load the values automatically without clicking the preference menu? 是否可以在不单击首选项菜单的情况下自动加载值?

您可以在oncreate()方法中使用它...

VAT_STRING = preferences.getString("TAXVAT", "5");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM