我正在使用需要上下文的计时器。现在我有以下代码:
mContext=context;
mEventID=eventID;
CountDownTimer cdTimer = new CountDownTimer(20000, 1000) {
public void onTick(long millisUntilFinished) {
// Do nothing onTick... Sorry
}
public void onFinish() {
int deletedRows = mContext.getContentResolver().delete()
// ..rest of code
}
};
cdTimer.start();
这使用安全吗,还是我可能会在这里泄露上下文?顺便提一句。这是在一个broadcastreceiver
.