2

My android app saves user information as serialized objects in a ".ser" file that's saved to internal storage. The data can be stored and retrieved and written just fine but whenever the user installs an update to the app, all the data is erased. I assume the file is deleted upon installation of an update. My question is: how do I save data to internal storage without it getting deleted when users install updates? Do I have to use a different method, like SharedPreferences or SQLite? or can my FileOutputStream save persistently through updates?

4

2 に答える 2

0

内部メモリで消されてしまうのが気になるなら、extに書き込んでみませんか?

于 2011-05-16T01:05:40.993 に答える
0

こんにちはボロン 私はSharedPreferencesあなたが説明している目的のために使用しています。画像やユーザーのバイオなどの大きな情報を保存したい場合があるため、SQLiteは好ましくないと思います。

私はすべてのユーザー データを共有設定に保存しており、アプリケーションを更新してもデータが保持されることはほぼ確実です。これで問題が解決するはずです。

画像を保存する必要がある場合は、画像を base 64 または何らかの文字列に変換して保存することをお勧めしますSharedPreferences。ユーザーが誤ってモバイルから画像を削除する可能性を減らします。

ハッピーコーディング

于 2016-04-12T06:55:28.980 に答える