如何显示警报? [英] how to display the alerts?

查看:110
本文介绍了如何显示警报?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
如何在线程概念中使用计时器实现在后台每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);


这篇关于如何显示警报?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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