UserDefault在安卓下,没有生成UserDefault.xml。

本人是新手……

在安卓上发现这问题……

首先代码是这样写的。

        UserDefault::getInstance()->setStringForKey("Test","Test");
        UserDefault::getInstance()->flush();

        information->setString(StringUtils::format("It is newest version!"));

        string str;
        str = "WritablePath:\n";
        str += FileUtils::getInstance()->getWritablePath();
        str += "\n";
        str += "XMLFilePath:\n";
        str += UserDefault::getInstance()->getXMLFilePath();
        str += "\n";

        string xmlFilePath = UserDefault::getInstance()->getXMLFilePath();
        int isFileExist = (int)FileUtils::getInstance()->isFileExist(xmlFilePath);

        str += "Check file:"  + StringUtils::format("%d",isFileExist);
        information->setString(str.c_str());

```


infomation是一个label,显示信息用的……

然后win32是这么一个结果……是正常的。

![](http://h.picphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=a5a32972bf12c8fcb0f3f2cbcc33a934/6a600c338744ebf8cd643f6ddff9d72a6059a74f.jpg)



然后Android上是这样的:

![](http://d.picphotos.baidu.com/album/s%3D1600%3Bq%3D90/sign=a8cddd33fe1986184547eb827add1502/77c6a7efce1b9d16e62cc233f5deb48f8d5464fc.jpg)


然后我用RE文件浏览器查了路径,还真没有UserDefault.xml。不知道为什么Android上没这个文件。
因为这个问题,导致项目在Android上不能正常的跑了……

首次在这里发帖……
向各位求教……

代码凌乱了,再发一次……

    UserDefault::getInstance()->setStringForKey("Test","Test");
    UserDefault::getInstance()->flush();

    information->setString(StringUtils::format("It is newest version!"));

    string str;
    str = "WritablePath:\n";
    str += FileUtils::getInstance()->getWritablePath();
    str += "\n";
    str += "XMLFilePath:\n";
    str += UserDefault::getInstance()->getXMLFilePath();
    str += "\n";

    string xmlFilePath = UserDefault::getInstance()->getXMLFilePath();
    int isFileExist = (int)FileUtils::getInstance()->isFileExist(xmlFilePath);

    str += "Check file:"  + StringUtils::format("%d",isFileExist);
    information->setString(str.c_str());

在android不叫这个名字,而且XML格式也不一样
在android data\data\包名\share。。。 大概这个目录下可以找到