读取文件属性并相应地启用/禁用复选框和列表框中的列表值时,我得到了 GUI 闪烁。当我删除此文件读取代码时,GUI 没有闪烁。
在 OnCreate() 中创建首选项之前,我正在阅读属性。附上下面的文件编写代码以供参考。请让我们知道是否有其他方法可以读取和更新首选项状态。
private void SetExtendConf(String key, String strValue)
{
mProperties = new Properties();
try {
File file = new File(FILE_EXT);
if(!file.exists())
file.createNewFile();
file.setWritable(true,false);
FileInputStream fis = new FileInputStream(file);
mProperties.load(fis);
fis.close();
FileOutputStream stream = new FileOutputStream(file);
Log.d(TAG, "Setting Values " + key + ":"+ strValue);
mProperties.setProperty(key, strValue);
mProperties.store(stream,"ext.conf");
stream.close();
} catch (IOException e) {
Log.d(TAG, "Could not open properties file: " + GPS_FILE_EXT);
}
}
-马诺伊