避免Toast多次弹出

来源:互联网 发布:在线seo外链工具软件 编辑:程序博客网 时间:2024/05/22 13:25
    public class Util {    private static Toast toast;    public static void showToast(Context context,         String content) {        if (toast == null) {            toast = Toast.makeText(context,                         content,                          Toast.LENGTH_SHORT);        } else {            toast.setText(content);        }        toast.show();    }    }
0 0