private boolean isTodayFirst() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Timestamp currentTimeStamp = new Timestamp(System.currentTimeMillis());
String nowTime = sdf.format(currentTimeStamp);
String lastRequestTime = PreferenceUtil.getInstance(act).getString("lastRequestTime", "");
if (lastRequestTime.equals(nowTime)) {
return false;
} else {
return true;
}
}
USE
public void toUse() {
if (!isTodayFirst()) return;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Timestamp currentTimeStamp = new Timestamp(System.currentTimeMillis());
String nowTime = sdf.format(currentTimeStamp); PreferenceUtil.getInstance(act).saveString("lastRequestTime", nowTime);
吧啦吧啦吧啦
}