首先判断是否具有toast实例,具有的话就不再创建toast实例,直接改变吐司内容,最终实现疯狂Toast
private Toast toast=null;
protected void showShortToast(String text) {
if (toast==null){
toast=Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT);
}else {
toast.setText(text);
}
toast.setGravity(Gravity.CENTER,0,60);
toast.show();
}