ToastUtil工具类

自定义toast,解决系统toast连续弹出,长时间不消失的问题

public class ToastUtil {   
  private static Toast toast = null;   
  public static void showTextToast( String msg) {      
    if (toast == null) {         
      toast = Toast.makeText(MyApplication.getInstance(), msg, Toast.LENGTH_SHORT);  
    } else {      
      toast.setText(msg);      
    }      
    toast.show();  
  }
}

你可能感兴趣的:(ToastUtil工具类)