Android Toast(吐司)简单封装,且解决了Toast显示时间叠加问题。
public class ToastUtil {    private static Toast toast=null;    public static void showToast(Context context,String content){        if(toast!=null) {            toast.cancel();        }        toast=Toast.makeText(context,content,Toast.LENGTH_LONG);        toast.show();    }}使用
ToastUtil.showToast(MainActivity.this,getString(R.string.exit_app));
版权声明:本文为博主原创文章,未经博主允许不得转载。