码迷,mamicode.com
首页 > 其他好文 > 详细

避免Toast重复弹出

时间:2018-01-25 15:35:06      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:log   ttext   搜索   div   避免   重复   oid   style   blog   

Toast.matkText才会创建一个新的实例

private Toast toast = null;

private void checkToastResult() {
    if (toast != null) {
        toast.setText("没有搜索结果");
        toast.setDuration(Toast.LENGTH_SHORT);
    } else {
        toast = Toast.makeText(context, "没有搜索结果", Toast.LENGTH_SHORT);
    }
    toast.show();
}

 

避免Toast重复弹出

标签:log   ttext   搜索   div   避免   重复   oid   style   blog   

原文地址:https://www.cnblogs.com/anni-qianqian/p/8351128.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!