取消handler.postdelayed过程 [英] cancelling a handler.postdelayed process

查看:760
本文介绍了取消handler.postdelayed过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用handler.postdelayed创建一个等待期我的应用程序的下一阶段发生之前。在等待期间,我与显示进度条和取消按钮的对话框。我的问题是我无法找到一个方法来取消该时间结束前的postdelayed任务。有什么建议么? 罗恩

解决方案

  myHandler.postDelayed(myRunnable,SPLASH_DISPLAY_LENGTH);
 

我这样做是为了发布延迟可运行。

这将其删除。 myHandler.removeCallbacks(myRunnable);

I am using handler.postdelayed to create a waiting period before the next stage of my app takes place. During the wait period I am displaying a dialog with progress bar and 'cancel' button. My problem is I cant find a way to cancel the postdelayed task before the time elapses. Any suggestions? Ron

解决方案

myHandler.postDelayed(myRunnable, SPLASH_DISPLAY_LENGTH); 

I do this to post a delayed runnable.

And this to remove it. myHandler.removeCallbacks(myRunnable);

这篇关于取消handler.postdelayed过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆