Java 更新Android应用程序上的文件会发生什么变化?

Java 更新Android应用程序上的文件会发生什么变化?,java,android,Java,Android,我有Android应用程序,它有1.2版本。 在google playe中导入新版本应用程序:1.3 更新后,我会丢失以前应用程序中的所有文件。 在安卓4.1.2中一切正常,但在安卓4.2.2中我有这个问题 这是我的代码: String HistoryFileName="History"; if (!fileExistance(HistoryFileName)) { FileOutputStream fos = context.openFileOutput(History

我有Android应用程序,它有1.2版本。 在google playe中导入新版本应用程序:1.3 更新后,我会丢失以前应用程序中的所有文件。 在安卓4.1.2中一切正常,但在安卓4.2.2中我有这个问题 这是我的代码:

   String HistoryFileName="History";
    if (!fileExistance(HistoryFileName)) {

    FileOutputStream fos = context.openFileOutput(HistoryFileName,Context.MODE_MULTI_PROCESS);
    Gson gson = new GsonBuilder().create();
    HistoryModel jsObj=new HistoryModel(newBalance);
    balance=newBalance;
    String jsonString=gson.toJson(jsObj);  
    String jsonEncryptData = StringCrypto.encrypt(KEY,jsonString);

       fos.write(jsonEncryptData.getBytes());
       fos.flush();
       fos.close();
    }
    else{

        balance=GetHistoryItemsObject(HistoryFileName).balance; 

    }

public static boolean fileExistance(String fname)
{
    File file = context.getFileStreamPath(fname);
    if (file.exists()) {
        return true;
    } else {
        return false;
    }
}
fileExistance(HistoryFileName)get true,如果我有该文件,o.w false;
在1.2版本中,我已经创建了“历史记录”文件,但是当我更新我的应用程序时,我的文件在Android 4.2.2中丢失了,但在Android 4.1.2中都没有问题

请发布
fileExistance
方法主体。并确定您存储文件的位置。将我的文件存储在data/data/com.playeroid./History中