<bdo id='3bYFZ'></bdo><ul id='3bYFZ'></ul>
    <legend id='3bYFZ'><style id='3bYFZ'><dir id='3bYFZ'><q id='3bYFZ'></q></dir></style></legend>

  • <small id='3bYFZ'></small><noframes id='3bYFZ'>

  • <i id='3bYFZ'><tr id='3bYFZ'><dt id='3bYFZ'><q id='3bYFZ'><span id='3bYFZ'><b id='3bYFZ'><form id='3bYFZ'><ins id='3bYFZ'></ins><ul id='3bYFZ'></ul><sub id='3bYFZ'></sub></form><legend id='3bYFZ'></legend><bdo id='3bYFZ'><pre id='3bYFZ'><center id='3bYFZ'></center></pre></bdo></b><th id='3bYFZ'></th></span></q></dt></tr></i><div id='3bYFZ'><tfoot id='3bYFZ'></tfoot><dl id='3bYFZ'><fieldset id='3bYFZ'></fieldset></dl></div>

      <tfoot id='3bYFZ'></tfoot>
      1. SharedPreferences &amp;布尔值

        SharedPreferences amp; boolean(SharedPreferences amp;布尔值)

        <small id='9Efoz'></small><noframes id='9Efoz'>

      2. <i id='9Efoz'><tr id='9Efoz'><dt id='9Efoz'><q id='9Efoz'><span id='9Efoz'><b id='9Efoz'><form id='9Efoz'><ins id='9Efoz'></ins><ul id='9Efoz'></ul><sub id='9Efoz'></sub></form><legend id='9Efoz'></legend><bdo id='9Efoz'><pre id='9Efoz'><center id='9Efoz'></center></pre></bdo></b><th id='9Efoz'></th></span></q></dt></tr></i><div id='9Efoz'><tfoot id='9Efoz'></tfoot><dl id='9Efoz'><fieldset id='9Efoz'></fieldset></dl></div>

            • <bdo id='9Efoz'></bdo><ul id='9Efoz'></ul>

                • <tfoot id='9Efoz'></tfoot>
                    <tbody id='9Efoz'></tbody>
                  <legend id='9Efoz'><style id='9Efoz'><dir id='9Efoz'><q id='9Efoz'></q></dir></style></legend>
                  本文介绍了SharedPreferences &amp;布尔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我试图在执行方法时将isPhysicalTheftEnabled"设置为 false,但这似乎不起作用.有人知道吗?

                  I'm trying to set the "isPhysicalTheftEnabled" to false when a method is executed, but this doesn't seem to work. Anyone have any idea?

                          SharedPreferences sp = getSharedPreferences("isPhysicalTheftEnabled", MODE_WORLD_READABLE);
                          SharedPreferences.Editor ed = sp.edit();
                          ed.putBoolean("isPhysicalTheftEnabled", false);
                  

                  推荐答案

                  尝试添加 ed.commit().

                  即:

                  SharedPreferences sp = getSharedPreferences("isPhysicalTheftEnabled", MODE_WORLD_READABLE);
                  SharedPreferences.Editor ed = sp.edit();
                  ed.putBoolean("isPhysicalTheftEnabled", false);
                  ed.commit();
                  

                  SharedPreferences.Editor要求您提交您在 SharedPreferences 中所做的任何更改,以便应用更改.

                  SharedPreferences.Editors require that you commit anything you change in your SharedPreferences for the changes to apply.

                  关于您对 Ankit 回答的评论:

                  要根据保存到 SharedPreferences 的布尔值设置 CheckBox 的选中属性,您需要类似以下内容:

                  To set the checked property of your CheckBox based on the value of the boolean you saved to SharedPreferences, you need something like:

                  SharedPreferences sp = getSharedPreferences("isPhysicalTheftEnabled", MODE_WORLD_READABLE);
                  myCheckBox.setChecked(sp.getBoolean("isPhysicsTheftEnabled", [true/false]);
                  

                  .. 为 .getBoolean()def_value 选择 truefalse (如果 SharedPreferences 找不到布尔值).

                  .. in which you pick either true or false for the def_value of .getBoolean() (if the SharedPreferences can't find the boolean).

                  这篇关于SharedPreferences &amp;布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
                  cocos2d-android: how to display score(cocos2d-android:如何显示分数)
                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  Android file copy(安卓文件拷贝)
                  Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)
                  <legend id='z6oBp'><style id='z6oBp'><dir id='z6oBp'><q id='z6oBp'></q></dir></style></legend>

                  <small id='z6oBp'></small><noframes id='z6oBp'>

                    • <tfoot id='z6oBp'></tfoot>
                      <i id='z6oBp'><tr id='z6oBp'><dt id='z6oBp'><q id='z6oBp'><span id='z6oBp'><b id='z6oBp'><form id='z6oBp'><ins id='z6oBp'></ins><ul id='z6oBp'></ul><sub id='z6oBp'></sub></form><legend id='z6oBp'></legend><bdo id='z6oBp'><pre id='z6oBp'><center id='z6oBp'></center></pre></bdo></b><th id='z6oBp'></th></span></q></dt></tr></i><div id='z6oBp'><tfoot id='z6oBp'></tfoot><dl id='z6oBp'><fieldset id='z6oBp'></fieldset></dl></div>
                        <bdo id='z6oBp'></bdo><ul id='z6oBp'></ul>

                            <tbody id='z6oBp'></tbody>