自定義toast,解決系統(tǒng)toast連續(xù)彈出炉媒,長時間不消失的問題
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();
}
}