首页 > 学院 > 开发设计 > 正文

Toast工具类

2019-11-08 00:16:29
字体:
来源:转载
供稿:网友
package com.xinchuang.buynow.util;import android.content.Context;import android.widget.Toast;/** * Toast工具类 * Created by 123 on 2017/2/23. */public class ToastUtil {    PRivate static Toast mtoast;    /**     * 长时间的Toast     */    public static void showLong(Context context, String message){        if (mtoast ==null){            mtoast = Toast.makeText(context,message,Toast.LENGTH_LONG);        }else{            mtoast.setText(message);        }        mtoast.show();    }    /**     * 短时间的Toast     */    public static void showShort(Context context, String message){        if (mtoast ==null){            mtoast = Toast.makeText(context,message,Toast.LENGTH_SHORT);        }else{            mtoast.setText(message);        }        mtoast.show();    }    /**     * 隐藏Toast     */    public static void hint(){        if (mtoast !=null){            mtoast.cancel();        }    }}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表