对于Toast的使用

来源:互联网 发布:电脑突然连接不上网络 编辑:程序博客网 时间:2024/06/01 07:22

这个工具类是阅读郭大牛的文章记录下来的方法,没有想过这些细节的问题,记录一下以后学习:


public class Utils{

private static Toast toast;

public static void showToast(Context context,String content){

     if( toast == null){

          toast =Toast.makeText(COntext context,String content){

          toast = Toast.makeText(context,content,Toast.Length_ShORT);


}else{

   toast.setText(content);

}

toast.show();


}

  

}

}

0 0