Code example for TimerTask

Methods: cancel

0
        Log.e("Download", "ondestroy");
 
        getTrafficStats(); // last count 
 
        if (timerTask != null) {
            timerTask.cancel();
        } 
        if (timer != null) {
            timer.cancel();
            timer.purge();
        } 
    } 
 
    private String operatorName;
    private long curTx, curRx, preTx, preRx;
    private NetworkInfo networkInfo;
 
    private void getTrafficStats() { 
 
        curTx = TrafficStats.getUidTxBytes(mUid);
Experience pair programming with AI  Get Codota for Java