try {
mTimerGoOut = new Timer();
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss aa", Locale.US);
Date curDate = new Date();
Date start = sdf4.parse(sdf3.format(curDate) + " " + params.get(DBEntity.SyncData.COLUMN_NAME_REASON_START));
Date end = sdf4.parse(sdf3.format(curDate) + " " + params.get(DBEntity.SyncData.COLUMN_NAME_REASON_END));
long time1 = 10 * 60 * 1000;
GoOutTask task = new GoOutTask();
task.handler = handlerGoOut;
long delay = end.getTime() - start.getTime() + time1;
Log.e("TimerGoOut", String.valueOf(delay));
mTimerGoOut.schedule(task, delay, time1);
} catch (Exception e) {
Log.e("TimerGoOut", e.toString());
}
Timer mTimerGoOut = null; @Override
public void onDestroy() {
if (mTimerGoOut != null) {
mTimerGoOut.cancel();
mTimerGoOut.purge();
mTimerGoOut = null;
Log.e("TimerGoOut", "Destroy");
}
super.onDestroy();
}