我目前有這個問題「File.creteNewFile()被忽略」。 好的,當拍照時,圖片將在圖像切換器中顯示,因此當我拍照並保存時,在拍攝另一張照片後它不會出現在圖像切換器中,則之前的圖片將出現在圖像切換器。 例如,當我拍攝了一張James的照片並保存後,它沒有出現在圖像切換器中,當我拍攝了Simon的照片後,James的照片出現在圖像切換器中,但是Simon沒有,並且拍攝下一張照片那麼Simon圖片將出現在圖像切換器中。File.createNewFile被忽略
public void Save() {
try {
File f = new File(mPath + "faces.txt");
f.createNewFile(); <-- this is where the method is ignored
BufferedWriter bw = new BufferedWriter(new FileWriter(f));
Iterator<label> Ilabel = thelist.iterator();
while (Ilabel.hasNext()) {
label l = Ilabel.next();
bw.write(l.thelabel + "," + l.num);
bw.newLine();
}
bw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e("error", e.getMessage() + " " + e.getCause());
e.printStackTrace();
}
}
我是新與Android,但我希望你們能幫助我:d
乾杯, 在此先感謝:d
喜劍:d是什麼sBody – bo2
數據你想要像JSON或文本或其他東西寫入文件 –