每次按下按钮,我的代码都会保存编辑文本中的字符串。但是,如果我再次输入相同的字符串,它会保存它。如果之前已保存,如何防止保存?
HistoryHelper file = new HistoryHelper(getBaseContext());
// get date
Calendar c = Calendar.getInstance();
int date = c.get(Calendar.DATE);
int month = c.get(Calendar.MONTH) + 1;// fixes wrong month
int year = c.get(Calendar.YEAR);
file.writeToSD("Date: " + year + "-" + month + "-" + date);
// get string
file.writeToSD(NEWLINK.toString());
// leave a blank line space
file.writeToSD("".toString());