ToastUtils 工具类

public class ToastUtils {

    private static Toast toast;

    public static void showMessage(Context context, String msg){
        if (toast == null) {
            toast = Toast.makeText(context.getApplicationContext(),msg,Toast.LENGTH_SHORT);
        }else{
            toast.setText(msg);
        }

        toast.show();
    }
}

 

posted @ 2018-01-04 10:35  贺长寿  阅读(1082)  评论(0编辑  收藏  举报