如何显示警报?

编程入门 行业动态 更新时间:2024-10-11 03:25:50
本文介绍了如何显示警报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 如何在线程概念中使用计时器实现在后台每5分钟显示文本的代码(我的意思是每5分钟在后台将文本显示为Toast消息类型),请帮助我解决问题

hi all, how to implement code for display the text one by one for every 5 min in the background by using timers in the threads concepts (i mean for every 5 min in the back ground display the text as toast message type) so kindly help me to solve the problem

推荐答案

final long interval = 5 * 60 * 1000; final Handler h = new Handler(); h.postDelayed(new Runnable() { @Override public void run() { Toast.makeText(getBaseContext(), "Hi", Toast.LENGTH_SHORT).show(); h.postDelayed(this, interval); } }, interval);

更多推荐

如何显示警报?

本文发布于:2023-11-27 16:10:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1638694.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!