Jus*_*sti 2 java checkbox android
所以,这根本不起作用.
CheckBox chck_bluetooth = (CheckBox) findViewById(R.id.chck_bluetooth);
if (mProperties.getProperty("bluetooth") == "true") {
chck_bluetooth.setChecked(true);
Log.i("Properties", "bluetooth = " + mProperties.getProperty("bluetooth"));
} else {
chck_bluetooth.setChecked(false);
Log.i("Properties", "bluetooth = " + mProperties.getProperty("bluetooth"));
}
Run Code Online (Sandbox Code Playgroud)
好吧,日志告诉我蓝牙设置为"true",所以我想复选框一定有问题.
如果属性值是字符串,则需要使用equals()它来比较它:
if (mProperties.getProperty("bluetooth").equals("true")) {
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4772 次 |
| 最近记录: |