0
我用下面的代碼保存密碼在一個txt文件:將數據保存到文件不能正常工作
String FILE_NAME="lol.txt";
public void writeData(String password){
FileOutputStream fOut = null;
OutputStreamWriter osw = null;
try{
fOut = openFileOutput(FILE_NAME, Context.MODE_PRIVATE);
osw = new OutputStreamWriter(fOut);
osw.write(password);
osw.close();
fOut.close();
}catch(Exception e){
e.printStackTrace(System.err);
}
}
但是當我retrive,我使用吐司其出現OK剛纔保存的密碼,但是當我登錄它變成我的logcat我有類似以下內容:
:gana???????????????????????????????????? .... and more four lines.
我使用Save方法,其作爲OnClikc方法的工作,設定的EditText的值作爲密碼,如下保存Word加納到我的文件
任何方式或線索我該如何解決這個問題?
問候
'當我檢索我剛剛使用吐司保存的密碼時...請顯示此代碼。 – techiServices
發佈您的閱讀文件代碼。 –