Android Timer使用的异常:Timer was canceled 处理方法
更新:HHH   时间:2023-1-7


1 异常日志:

            java.lang.IllegalStateException: Timer was canceled 

2 所做操作:

            调用cancel()取消后不能再执行 schedule语句,否则提示出现以上异常。

3 解决方案

            正确的中止Timer方法:

                    timer.cancel();

                    timer.purge();

                    timer = null;(可选)

返回移动开发教程...